I have various Git projects that are on my local machine. I have a server that I would like to use as my remote Git Repository. How do I move my local Git Repositories (Projects) to my server while keeping the history intact?
Thanks!
EDIT: Thanks for all the great answers. The response I choose makes sense to my limited GIT knowledge.
EDIT #2: I noticed my original answer selection did not copy my tags. git push --mirror <path>
does copy tags.
I think you make a bare repository on the remote side, git init --bare , add the remote side as the push/pull tracker for your local repository ( git remote add origin URL ), and then locally you just say git push origin master . Now any other repository can pull from the remote repository.
On your server create the git repositories as bare repository
git init --bare repo.git
then, push the commits of your local repository
git push --mirror ssh://yourserver/~/repo.git
First, create a git repo on your server
git init --bare /path/to/repo
Then add the remote repo to your local one (ssh:// or https://)
git remote add origin ssh://server/path/to/repo
And, push files/commits
git push origin master
And finally, push tags
git push origin --tags
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With