无法访问"git/属性" [英] Unable to access 'git/attributes'
问题描述
警告remote: warning: unable to access '/root/.config/git/attributes': Permission denied
的含义是什么?
$git clone git://git.eclipse.org/gitroot/egit/egit.git
Cloning into 'egit'...
remote: warning: unable to access '/root/.config/git/attributes': Permission denied
remote: Counting objects: 57926, done.
remote: Compressing objects: 100% (11872/11872), done.
remote: Total 57926 (delta 30734), reused 56308 (delta 29136)
Receiving objects: 100% (57926/57926), 32.29 MiB | 1021 KiB/s, done.
Resolving deltas: 100% (30734/30734), done.
Checking out files: 100% (1483/1483), done.
我应该向托管人报告潜在的基础设施问题吗?
Should I report potential infrastructure problem to hoster?
推荐答案
我自己遇到了这种情况.确认它在~/.config/
中查找后,我注意到该文件夹的所有者为root
.我将其更改为my_user_name
,并且有效.
I ran into this situation myself. After verifying that it was looking in ~/.config/
I noticed the owner of that folder was root
. I changed this to my_user_name
and it worked.
cd ~/
ls -al
<Noticed .config was owned by root, unlike everything else in $HOME>
sudo chown -R $(whoami) .config
这也有助于了解原因:该目录是在您第一次运行使用该目录的程序时创建的.如果该命令以root
身份运行,则将导致此权限问题.
It helps to know the cause as well: This directory is created the first time you run a program that uses it. If the command was run as root
, it will cause this permissions problem.
例如,如果~/.config
目录尚不存在,并且您运行sudo htop
,则目录~/.config
和~/.config/htop
将由root
创建并拥有.之后,常规的git命令将无法访问~/.config
并将给出以上警告. (信用:用户mehtunguh)
For example, if the ~/.config
directory does not yet exist, and you run sudo htop
, the directories ~/.config
and ~/.config/htop
will be created and owned by root
. Afterward, a regular git command wont be able to access ~/.config
and will give the above warning. (Credit: user mehtunguh)
chown
的-R
选项用于递归修改权限.如果您在~/.config
The -R
option with chown
is to modify the permissions recursively. This will help if you have subfolders under ~/.config
这篇关于无法访问"git/属性"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!