tags:

views:

35

answers:

3

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?

A: 

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!

Graham Perks
Thanks, I'll take a look at gitosis and see what I'm missing out on.
I installed gitosis and was able to push the repo to the external server. Thanks!
A: 

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 /.

Jeremy W. Sherman
I've tried copying the repo over, both with scp and tar the folder first. I can get the files there, but then when I try a git log of the new repo, there are fatal errors.
+1  A: 

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
Jakub Narębski
Hm so I tried this...B$ git init --bare externalA$ git push ssh://user@B/full/path/to/repo.gitI get that these messages:No refs in common and none specified; doing nothing.Perhaps you should specify a branch such as 'master'.fatal: The remote end hung up unexpectedly
@user481826: I am sorry, I mixed up simpler to use but more complicated to set-up approach where you create "remote" configuration for pushing from A to B with URL-based config-less approach, where you have to specify branch(es) to push, or use `--all`/`--mirror`.
Jakub Narębski
A$ git push ssh://B/full/path/to/repo.git '*:*'
Casey