Reputation: 78598
I have cloned a project from a server using git clone
and I now want to copy it (all branches) to another server so other people can start using it. I guess I could simply copy the entire repository manually and then issue git config --bool core.bare true
and delete everything but the .git
folder but I don't think that qualifies as a 'bare' repository and I'm worried it might give me problems.
I was hoping I could create the new remote repository using git init --bare
and simply push my local one to it but as I originally cloned my local copy from another server, the origin
seems to be blocking me from doing this.
Upvotes: 34
Views: 20620
Reputation: 38708
git init --bare newrepo.git
git remote add newrepo git://[email protected]/newrepo.git
git push newrepo master
to push a particular branch, orgit push --all newrepo
to push all branchesUpvotes: 51
Reputation: 137252
Another way is (as you wished):
git clone --bare /path/to/repo newrepo.git
Upvotes: 13