Creating a remote git repository from an existing local one.

This is here to remind me how to create a remote repository if I have an already existing repo and I want to have a backup on a remote server. This is probably only useful if you have a small repo as it will require the copying and checkout of the whole thing.

This first thing to do is create a bare copy of your repository

git clone --bare repo repo.git

Then copy the clone to the remote server

rsync -avz repo.git username@remote_host:/var/repos/

Move the existing code out of the way and clone the remote location

mv repos repos_orig
git clone ssh://remote_host/var/repos/repo.git repo

Finally, check that the new clone is complete and working and remove the original copy.

Posted by neomorphic Thu, 29 Oct 2009 02:48:00 GMT



weewar.com corner