git - 尝试 git pull 错误 : cannot open . git/FETCH_HEAD: Permission denied

标签 git github pull

请帮助我,我正在尝试在我的终端中运行它:

asgard@asgard-A7N8X2-0:~/CollegePortal$ git pull
error: cannot open .git/FETCH_HEAD: Permission denied

那我试试这个

asgard@asgard-A7N8X2-0:~/CollegePortal$ sudo git pull
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

帮帮我,我不明白这个问题。

最佳答案

第一个似乎不起作用,因为您的用户没有更改该目录的权限,第二个是因为您的根用户没有访问该 git 存储库的正确 SSH key 。

根据您要执行的操作,最好将存储库克隆到不同的目录,或者 chown 当前目录以便您的用户拥有完全访问权限

关于git - 尝试 git pull 错误 : cannot open . git/FETCH_HEAD: Permission denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13195814/

相关文章:

git - 为什么会得到 : when i press git log command

git - 致命的 : remote part of refspec is not a valid name in :capabilities^{}

git - 什么可能导致 `git pull` 无法看到远程更改?

macos - Git 认为我是错误的用户

git - 无法从 mac 终端 pull/推到 github 上的远程仓库

Git Pull 不执行 Git Fetch

Xcode 说 "Uncommitted Changes"每当我尝试 git pull 或 push

bash - 如何将变量注入(inject) git submodule foreach?

git - 使用提交的 Git 子模块时有哪些选项?

git - 使用用作模块源的 bitbucket 存储库处理 ssh/https 身份验证