第一次提交到git存储库时出现问题

时间:2011-12-04 17:12:19

标签: git github terminal commit git-commit

我是Git的新手,已经设置好并创建了我的第一个存储库。我试图将README作为第一次提交添加,并且我一直在完全遵循http://help.github.com/create-a-repo/上的步骤,但我仍然坚持这一步:

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 git@github.com: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'

如何清理它并获得正确的遥控器?

1 个答案:

答案 0 :(得分:15)

您只需要删除带有错误引用的origin遥控器:

$ git remote rm origin

然后重新启动添加,推送,你应该很高兴。

$ git remote add origin git@github.com:christineh/Hello-World.git
$ git push -u origin master
相关问题