[英]Permission denied for gitconfig in Microsoft hosted devops agent
Using git command in pipeline: git config --system --add 'url azure-devops' Authorization:Bearer $token在管道中使用 git 命令:git config --system --add 'url azure-devops' Authorization:Bearer $token
output: /usr/bin/bash --noprofile --norc /home/vsts/work/_temp/f76ec2f0-0843-41ba-8959-8534015c5e43.sh error: could not lock config file /etc/gitconfig: Permission denied ##[error]Bash exited with code '255'. output:/usr/bin/bash --noprofile --norc /home/vsts/work/_temp/f76ec2f0-0843-41ba-8959-8534015c5e43.sh 错误:无法锁定配置文件/etc/gitconfig:权限被拒绝## [错误] Bash 以代码“255”退出。 Finishing: Configure Git token
完成:配置 Git 令牌
I tried to set permission as well but it doesnot work.我也尝试设置权限,但它不起作用。 Also its related to etc directory which need root user.
它也与需要root用户的etc目录有关。 Any idea or suggestions on this, please?
请问对此有什么想法或建议吗?
As you've noted, your command requires root and it's failing because you don't have it.正如您所指出的,您的命令需要 root 并且它失败了,因为您没有它。 That's because you've used the
--system
flag to git config
, which modifies the system configuration file, usually stored in /etc/gitconfig
.那是因为你使用了
git config
的--system
标志,它修改了系统配置文件,通常存储在/etc/gitconfig
中。
It would be better to use --global
if you need something for all repositories on a CI system, and that file should be modifiable by your user.如果您需要为 CI 系统上的所有存储库提供一些东西,那么使用
--global
会更好,并且该文件应该可由您的用户修改。 Alternately, if you have just a single repository already and want to use it, you can use --local
(or omit the flag) to set it only locally.或者,如果您已经只有一个存储库并且想要使用它,您可以使用
--local
(或省略标志)仅在本地设置它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.