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 (Pro
If you have a stand-alone local working tree repository (a folder with a ".git" folder inside) that you want to add a remote to:
In the local repository, set the new remote as the origin:
cd localrepo
git remote add origin REMOTEURL #(verify with git remote -v)
Push all local branches to the remote, and set each local branch to track the corresponding remote branch:
git push --all --set-upstream origin #(verify with git branch -vv)
Push all local tags to the remote:
git push --tags origin
At this point the local repository will act just like it had been cloned from the remote.
If you have a bare local repository (a folder with a name ending in .git) that you just want to copy to a remote:
In the local repository, push all of its branches to the remote
cd localrepo.git
git push --all REMOTEURL
Push all local tags to the remote:
git push --tags REMOTEURL