2011-12-04 43 views
5

我是Git的新手,并且已经设置并创建了我的第一个存储库。我想添加一个README作为第一个承诺,我一直在关注上正好http://help.github.com/create-a-repo/的步骤,但我卡住这一步:第一次提交git存储库时遇到问题

git push -u origin master 

我得到这个错误:

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

我认为这是因为我得到了git remote add命令错误:我忘了替换我的用户名和存储库名称。用正确的参数重试它给我:

$ 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' 

我该如何清理并获得正确的远程?

+0

您在'git remote add'命令中替换了您的用户名和git repo名称,不是吗? – Mat

+0

你有GitHub账户吗?我遵循'http:// help.github.com/create-a-repo /'中的步骤并在GitHub上创建了一个名为Hello-World的存储库。远程设置命令GitHub提示我在本地机器上使用'git remote add origin [email protected]:srivaths/Hello-World.git'。注意到里面没有“用户名”。 –

+0

@Sri Sankaran - 我输入这个命令时得到的是:$ git remote add origin [email protected]:christineh/Hello-World.git 致命的:远程原点已经存在。 –

回答

15

你只需要删除origin遥控器,具有与不正确的引用:

$ git remote rm origin 

然后重新添加,并推动的,你应该是好去。

$ git remote add origin [email protected]:christineh/Hello-World.git 
$ git push -u origin master 
相关问题