简体   繁体   中英

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 works fine separately, but as a part of jenkins, I am facing permission denied issue

> 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.

  1. SSH to your server.
  2. Switch user to jenkins.
  3. Try git clone.

Try adding jenkins user to sudores using this link and give permissions to this user, add SSH(git) key for git clone.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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