将代码推送回 Github 仓库

6
我使用以下命令将我的一个github仓库克隆到我的办公桌面电脑:
git clone git://github.com/indiajoe/MyRepo.git

在进行了一些更改并提交后,我无法使用命令将更改推回存储库。

git push -u orgin master

以下是错误信息。

fatal: 'orgin' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我试图重新输入如下所示的地址。

git remote rm origin
git remote add origin https://github.com/indiajoe/MyRepo.git

即使如此,我仍然会遇到相同的错误。 我的git remote -v的输出结果是:

origin  https://github.com/indiajoe/MyRepo.git (fetch)
origin  https://github.com/indiajoe/MyRepo.git (push)

这里可能出了什么问题?

PS:在克隆时,我无法通过以下命令使用https进行克隆

git clone https://github.com/indiajoe/MyRepo.git

但是使用该命令克隆时没有出现任何问题:

git clone git://github.com/indiajoe/MyRepo.git

我不知道为什么会发生这种情况。但是这可能与问题有关吗?

1个回答

7
git push -u `orgin` `master`

这不应该起作用:它是“origin”,而不是“orgin”;)
因此,默认情况下,这应该起作用:
git push -u origin master

(正如我在 "为什么需要显式推送新分支?" 中详细说明的那样)

2
哦天啊,这太尴尬了。我花了好几个小时试图找出问题所在... - indiajoe
4
@indiajoe,我们都经历过这个阶段,相信我 ;) - VonC

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接