I am trying to follow along Michael Hartl's Rails tutorial but I've run across an error.
I signed up on Github and issued a new SSH key and made a new repository. But when I enter the next line into the terminal I get the following error:
Parkers-MacBook-Pro:.ssh ppreyer$ git remote add origin git@github.com:ppreyer/first_app.git
fatal: remote origin already exists.
Just wondered if anybody else has run across this problem?
You can see what remote repositories you are configured to connect to via
That will return a list in this format:
That might help you figure out what the original 'origin' pointed to.
If you want to keep the remote connection that you see with the -v, but still want to follow the Rails tutorial without having to remember 'github' (or some other name) for your tutorial's repo, you can rename your other repository with the command:
as in:
You should then be able to resume your tutorial.
If you need to check which remote repos you have connected with your local repos, theres a cmd:
Now if you want to remove the remote repo (say, origin) then what you can do is:
In the special case that you are creating a new repository starting from an old repository that you used as template (Don't do this if this is not your case). Completely erase the git files of the old repository so you can start a new one:
And then restart a new git repository as usual:
for using git you have to be
if not then use sudo
for adding origin :
git remote add origin http://giturl
Try this
That error message indicates that you already have a remote in your git directory. If you are satisfied with that remote, your can push your code. If not or if you can't push just:
Voilà !