简体   繁体   English

Jenkins权限被拒绝的GIT克隆问题

[英]GIT clone issue in Jenkins Permission Denied

I am trying to pull some documents from git using git clone as part of a jenkins process. 我试图使用git clone从git中提取一些文件作为jenkins进程的一部分。 Git clone works fine separately, but as a part of jenkins, I am facing permission denied issue Git clone可以单独使用,但作为jenkins的一部分,我面临着被拒绝的问题

> echo "pw"| sudo git clone host@IP:git-repo 


> Cloning into 'git-repo'... 
Permission denied, please try again.
Permission denied, please try again.
Permission denied(publickey,password).

fatal: Could not read from remote repository. 致命:无法从远程存储库读取。

尝试使用SSH代理插件使您的私钥可以访问常规构建步骤。

Jenkins creates a system user to your system with name jenkins. Jenkins使用名称jenkins为系统创建系统用户。

  1. SSH to your server. SSH到您的服务器。
  2. Switch user to jenkins. 将用户切换到jenkins。
  3. Try git clone. 试试git clone。

Try adding jenkins user to sudores using this link and give permissions to this user, add SSH(git) key for git clone. 尝试使用此链接将jenkins用户添加到sudores并为该用户授予权限,为git clone添加SSH(git)密钥。

This may solve your issue. 这可以解决您的问题。 :) :)

Try this, 试试这个,

superuser ALL=(ALL) NOPASSWD:ALL - for single user 

refer link 参考链接

This setting help us to bypass user prompt. 此设置可帮助我们绕过用户提示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM