请帮助我,我试图在我的终端运行这个:

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

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


当前回答

当我在windows上使用git扩展时,我得到了这个消息。我的解决方案是简单地关闭git扩展,然后以管理员身份再次打开

其他回答

在我的案例工作中,我只是在命令之前写了sudo:

sudo npm run deploy

如果你想给小组权限,

sudo chmod g+w .git -R

对我来说是最好的。

是操作系统

sudo chmod -R g+w .git 

当。git文件夹被隐藏时,其中的所有文件也被隐藏。 只隐藏.git文件夹而不更新递归文件,它将工作。

这将解析文件夹中的所有权限

sudo chown -R $(whoami) ./

只需转到您的根文件夹并运行以下命令:

chmod a+rw .git/FETCH_HEAD