Github:远程似乎不是 git 存储库

问题描述

我在 Github 抛出错误时遇到了一些问题:fatal: 'remote' 似乎不是 git 存储库。

我进行了克隆,成功了。

a

然后我做了这个,结果出现了错误信息

git clone https://github.com/StephenW789/CIS-41B-Final-Project-Public

cd CIS-41B-Final-Project-Public

git remote -v # Prints out the correct origin as expected

我尝试了以下方法,但问题仍然存在。

git fetch remote main
fatal: 'remote' 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.

谢谢。

解决方法

这是因为 remote 不是遥控器的名称:origin 是遥控器的名称。那就是:你想要git fetch remote而不是git fetch origin

我和 Lasse V. Karlsen 和你自己一样,在最初的几次通读中错过了这一点。很容易将“remote”读作遥控器的正确名称。 :-)