git - Jenkins unable to fetch repo - code 255 permission denied -
i'm trying set jenkins work git webhooks. far have
- jenkins running
- created ssh key pair under
jenkins
user - added key git deploy keys
- added git plugin
- configured project use git repo
- set branch
*/develop
watch dev branch - set custom workspace directory
/data/www/<site>
- added
ubunutu
groupjenkins
user (see below)
and when trying build project, error:
started user anonymous building in workspace /data/www/<site> > git rev-parse --is-inside-work-tree # timeout=10 fetching changes remote git repository > git config remote.jenkins.url git@github.com:<repo_url> # timeout=10 error: error fetching remote repo 'jenkins' hudson.plugins.git.gitexception: failed fetch git@github.com:<repo_url> @ hudson.plugins.git.gitscm.fetchfrom(gitscm.java:735) @ hudson.plugins.git.gitscm.retrievechanges(gitscm.java:983) @ hudson.plugins.git.gitscm.checkout(gitscm.java:1016) @ hudson.scm.scm.checkout(scm.java:485) @ hudson.model.abstractproject.checkout(abstractproject.java:1276) @ hudson.model.abstractbuild$abstractbuildexecution.defaultcheckout(abstractbuild.java:610) @ jenkins.scm.scmcheckoutstrategy.checkout(scmcheckoutstrategy.java:86) @ hudson.model.abstractbuild$abstractbuildexecution.run(abstractbuild.java:532) @ hudson.model.run.execute(run.java:1744) @ hudson.model.freestylebuild.run(freestylebuild.java:43) @ hudson.model.resourcecontroller.execute(resourcecontroller.java:98) @ hudson.model.executor.run(executor.java:374) caused by: hudson.plugins.git.gitexception: command "git config remote.jenkins.url git@github.com:<repo_url>" returned status code 255: stdout: stderr: error: not lock config file .git/config: permission denied @ org.jenkinsci.plugins.gitclient.cligitapiimpl.launchcommandin(cligitapiimpl.java:1591) @ org.jenkinsci.plugins.gitclient.cligitapiimpl.launchcommandin(cligitapiimpl.java:1567) @ org.jenkinsci.plugins.gitclient.cligitapiimpl.launchcommandin(cligitapiimpl.java:1563) @ org.jenkinsci.plugins.gitclient.cligitapiimpl.launchcommand(cligitapiimpl.java:1249) @ org.jenkinsci.plugins.gitclient.cligitapiimpl.launchcommand(cligitapiimpl.java:1261) @ org.jenkinsci.plugins.gitclient.cligitapiimpl.setremoteurl(cligitapiimpl.java:961) @ hudson.plugins.git.gitapi.setremoteurl(gitapi.java:160) @ hudson.plugins.git.gitscm.fetchfrom(gitscm.java:723) ... 11 more error: error fetching remote repo 'jenkins'
the repo has been pulled different user (in case, ubuntu:ubuntu
) in /data/www/<site>
directory, thought adding ubunutu
group jenkins
fix problem, no luck. i've tried logging in jenkins
user , pulling repo, can successfully.
i've tried googling can think of, searches point people having key problems, rather config file permission problems. @ point i'm out of ideas.
edit:
ls -la
in .git
dir:
drwxrwxr-x 2 ubuntu ubuntu 4096 mar 5 12:13 branches -rw-rw-r-- 1 ubuntu ubuntu 15 mar 5 18:09 commit_editmsg -rw-rw-r-- 1 jenkins jenkins 318 jun 1 14:55 config -rw-rw-r-- 1 ubuntu ubuntu 73 mar 5 12:13 description -rw-rw-r-- 1 ubuntu ubuntu 88 may 29 12:50 fetch_head -rw-rw-r-- 1 ubuntu ubuntu 24 may 28 13:21 head drwxrwxr-x 2 ubuntu ubuntu 4096 may 28 13:49 hooks -rw-rw-r-- 1 ubuntu ubuntu 36480 may 29 12:50 index drwxrwxr-x 2 ubuntu ubuntu 4096 mar 5 12:13 info drwxrwxr-x 3 ubuntu ubuntu 4096 mar 5 12:13 logs drwxrwxr-x 260 ubuntu ubuntu 4096 apr 10 10:40 objects -rw-rw-r-- 1 jenkins jenkins 41 may 29 11:53 orig_head -rw-rw-r-- 1 ubuntu ubuntu 179 mar 5 12:13 packed-refs drwxrwxr-x 5 ubuntu ubuntu 4096 mar 5 12:13 refs
ls -la
parent dir (it's laravel 5 app):
drwxrwxr-x 13 ubuntu ubuntu 4096 apr 3 11:07 app -rwxrwxr-x 1 ubuntu ubuntu 2452 mar 5 12:13 artisan drwxrwxr-x 2 ubuntu ubuntu 4096 mar 11 08:18 bootstrap -rwxrwxr-x 1 ubuntu ubuntu 1094 mar 11 08:16 composer.json -rw-rw-r-- 1 ubuntu ubuntu 79004 mar 11 08:17 composer.lock -rwxrwxr-x 1 ubuntu ubuntu 146 mar 5 12:13 contributing.md drwxrwxr-x 8 ubuntu ubuntu 4096 may 6 09:45 frontend drwxrwxr-x 8 ubuntu ubuntu 4096 jun 1 14:56 .git -rwxrwxr-x 1 ubuntu ubuntu 12 mar 5 12:13 .gitattributes -rwxrwxr-x 1 ubuntu ubuntu 160 mar 5 12:13 .gitignore -rwxrwxr-x 1 ubuntu ubuntu 567 mar 5 12:13 phpunit.xml drwxrwxr-x 7 www-data www-data 4096 mar 5 17:13 public -rwxrwxr-x 1 ubuntu ubuntu 2051 mar 5 12:13 readme.md -rwxrwxr-x 1 ubuntu ubuntu 519 mar 5 12:13 server.php drwxrwxr-x 29 ubuntu ubuntu 4096 mar 11 08:18 vendor
groups:
$ cat /etc/group | grep jenkins ubuntu:x:1000:jenkins jenkins:x:113: $ cat /etc/group | grep ubuntu adm:x:4:syslog,ubuntu dialout:x:20:ubuntu cdrom:x:24:ubuntu floppy:x:25:ubuntu sudo:x:27:ubuntu audio:x:29:ubuntu dip:x:30:ubuntu video:x:44:ubuntu plugdev:x:46:ubuntu netdev:x:102:ubuntu ubuntu:x:1000:jenkins
check owner / permissions of .git/config file in jenkins workspace. it's still owned ubuntu user. change owner jenkins user.
Comments
Post a Comment