I have a local git repo created by Qt Creator during the New Project Wizard. I've made many commits there. I have created a new Google Code project only now. What is the best way to sync the remote repo to my local one?
Asked
Active
Viewed 7,007 times
1 Answers
13
You can see an example at this article "Setting up Google Code with Git" from AlBlue’s Blog:
$ cd /path/to/existing/local/repo
$ git remote add googlecode https://project.googlecode.com/git
$ git push googlecode master:master
See git remote
command: if you have an existing remote (google code) repo ready, you can add its address to your local repo and start pushing (provided you did setup correctly your ~/.netrc
file as described in the article, or your %HOME%\_netrc
file for windows: see "Git - How to use .netrc
file on windows to save user and password" for more).
Once you have done a local commit, you can push the master
branch (see "Push origin master error on new repository"), and from there just git push googlecode
.
If your remote is called 'origin
', then after the first push, you will be able to just do 'git push
' for the future pushes.
-
BTW: how to set up the new remote in a such way that later `git push` would automatically push it there? – Kos Jan 22 '12 at 14:09
-
@Kos: I have edited my answer. You would need to call your remote repo 'origin' (see http://stackoverflow.com/questions/5270760/whats-mean-origin-when-git-push) – VonC Jan 22 '12 at 14:20
-
@VonC: Thanks for the bit about "Push origin master error on new repo". That was very helpful. – kevinarpe Jul 22 '13 at 19:42