简体   繁体   English

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

[英]Trouble with first commit to git repository

I'm new to Git, and have set it up and created my first repository. 我是Git的新手,已经设置好并创建了我的第一个存储库。 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: 我正在尝试添加README作为第一个提交,我一直在http://help.github.com/create-a-repo/上完全遵循这些步骤,但我仍然坚持这一步:

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. 我认为这是因为我得到了git remote add命令错误:我忘了替换我的用户名和存储库名称。 Retrying it with the correct arguments gives me: 用正确的参数重试它给了我:

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

How can I clean this up and get the correct remote? 我怎样才能清理它并获得正确的遥控器?

You simply need to remove the origin remote that has the incorrect reference with: 您只需要删除具有错误引用的origin远程:

$ git remote rm origin

Then restart the add, and push, and you should be good to go. 然后重新启动添加,然后推送,你应该很高兴。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM