开发者

How do I clone a repo to a remote server using ssh

I have two servers, A and 开发者_如何转开发B. A has the repo and can ssh to B. B is a new server I want to have the repo, but cannot ssh to A. I've tried copying the repo, create a remote to push, git clone with a -u... any suggestions?


Create empty repository on B

B$ git init --bare repo.git

then push to it from A using SSH protocol

A$ git push ssh://B/full/path/to/repo.git


One way which'll set B up as a remote to A, would be to install gitosis on B and then push the repo from A to B.

For more on gitosis, see http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way. If you're using git but not gitosis, you're missing out!


What do you mean when you say you've tried copying? Have you tried using scp like so?

scp -R path/to/repo/on/A user@B:desired/path/to/repo/on/B

Note that the path following : is relative to the user's home directory unless it begins with a /.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜