Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with first commit to git repository

I'm new to Git, and have set it up and created my first repository. I'm trying to add a README as the first commit, and I've been following the steps on http://help.github.com/create-a-repo/ exactly, but I get stuck on this step:

git push -u origin master

I get this error:

ERROR: username/Hello-World.git doesn't exist. Did you enter it correctly?

I think it is because I got the git remote add command wrong: I forgot to substitute my username and repository name. Retrying it with the correct arguments gives me:

$ git remote add origin [email protected]:christineh/Hello-World.git
 fatal: remote origin already exists.
$ git push -u origin master
Enter passphrase for key '/Users/christinehorvat/.ssh/id_rsa':
 ERROR: username/Hello-World.git doesn't exist. Did you enter it correctly?
 fatal: The remote end hung up unexpectedly'

How can I clean this up and get the correct remote?

like image 781
Christine Horvat Avatar asked Dec 04 '11 17:12

Christine Horvat


People also ask

Should I commit first or pull first?

If you have uncommitted changes, the merge part of the git pull command will fail and your local branch will be untouched. Thus, you should always commit your changes in a branch before pulling new commits from a remote repository.


1 Answers

You simply need to remove the origin remote that has the incorrect reference with:

$ git remote rm origin

Then restart the add, and push, and you should be good to go.

$ git remote add origin [email protected]:christineh/Hello-World.git
$ git push -u origin master
like image 70
Mat Avatar answered Oct 18 '22 19:10

Mat