如何将我的git reposity克隆到远程机器上? [英] How do I clone my git reposity to a remote machine?

查看:133
本文介绍了如何将我的git reposity克隆到远程机器上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在电脑上安装了一个git repo。我也有一台我可以使用的远程机器。我想克隆到远程机器的回购(然后保持它们与推和拉同步)。我该怎么做呢?我只从GitHub克隆过。

I have a git repo set up on my computer. I also have a remote machine that I can ssh into. I want to clone the repo to the remote machine (and then keep them in sync with push and pull). How do I do this? I've only ever cloned from GitHub.

推荐答案

<1>初始化 git仓库在远程机器上。

1) Initialize bare git repository on remote machine.

ssh remote_machine
mkdir my_project
cd my_project
git init --bare
git update-server-info # If planning to serve via HTTP

2)配置本地仓库能够从远程仓库中拉/推。

2) Configure local repo to be able to pull/push from remote one.

git remote add origin git@remote_machine:my_project.git
git push -u origin master

现在两台机器都同步。

这篇关于如何将我的git reposity克隆到远程机器上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆