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

发布于 2024-12-19 14:25:56 字数 917 浏览 1 评论 0原文

我是 Git 新手,并且已经设置并创建了我的第一个存储库。我正在尝试添加自述文件作为第一次提交,并且我一直在按照 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 [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'

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

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

倾城花音 2024-12-26 14:25:56

您只需删除引用不正确的 origin 远程:

$ git remote rm origin

然后重新启动添加和推送,就可以开始了。

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文