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

Chr*_*vat 5 git terminal commit github git-commit

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

git push -u origin master
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

ERROR: username/Hello-World.git doesn't exist. Did you enter it correctly?
Run Code Online (Sandbox Code Playgroud)

我认为这是因为我得到了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'
Run Code Online (Sandbox Code Playgroud)

我怎样才能清理它并获得正确的遥控器?

Mat*_*Mat 15

您只需要删除origin具有错误引用的远程:

$ git remote rm origin
Run Code Online (Sandbox Code Playgroud)

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

$ git remote add origin git@github.com:christineh/Hello-World.git
$ git push -u origin master
Run Code Online (Sandbox Code Playgroud)