Git从只读远程设备拉取失败

Git从只读远程设备拉取失败,git,github,Git,Github,我有一个分叉私有存储库的克隆,我正试图为其设置只读远程存储库 我已运行以下程序来设置内容: 克隆回购协议 git clone git@github.com:scottsuch/repo.git 向上游添加只读 git remote add upstream git://github.com/org-name/repo.git 下面是git remote-v show的输出 origin git@github.com:scottsuch/repo.git (fetch) origin gi

我有一个分叉私有存储库的克隆,我正试图为其设置只读远程存储库

我已运行以下程序来设置内容:

克隆回购协议

git clone git@github.com:scottsuch/repo.git
向上游添加只读

git remote add upstream git://github.com/org-name/repo.git
下面是git remote-v show的输出

origin  git@github.com:scottsuch/repo.git (fetch)
origin  git@github.com:scottsuch/repo.git (push)
upstream    git://github.com/org-name/repo.git (fetch)
upstream    git://github.com/org-name/repo.git (push)
现在,如果我试图通过git pull upstream master从上游引入更改,我会得到以下响应:

fatal: remote error:
  Repository not found.

我相当肯定这是一个标准的程序,并且已经看到了很多这样的例子。但是我不确定是否有一些权限问题。提前感谢。

原始存储库是私有的,因此您需要先进行身份验证,然后才能访问它。您当前的远程URL不是为身份验证而配置的,而是为公共访问而配置的

更改<代码>git://github.com/org-name/repo.git到其中一个

  • git@github.com:org name/repo.git
    使用SSH密钥,或
  • https://github.com/org-name/repo.git
    通过HTTPS使用密码身份验证
用两个命令

  • git远程设置上游url
  • git远程设置url——向上游推送

除非我在添加git@或https://verion时遗漏了什么,否则回购协议不能是只读的。在我的原始帖子中,我没有明确说明我正在试图避免意外地将代码推到上游,因此尝试使用只读URL。我提出的解决方案是通过git remote add upstream设置上游git@github.com:org/repo.git,然后使用示例
git remote set url--push-upstream来中断推送urlgit://github.com/org/repo.git
。它可以工作,但感觉很笨拙。
git@
https://
版本允许您向GitHub进行身份验证,第一个使用SSH密钥,第二个使用HTTP身份验证。目标存储库对GitHub的权限将决定您可以做什么和不能做什么。如果目标存储库是私有的,则必须先进行身份验证,然后才能从中
获取
提取
。这与GitHub的web UI没有什么不同;您需要先登录,然后才能访问私有存储库。