当我构建一个与Github链接的Jenkins项目时,我收到以下错误:
Started by user anonymous
Building in workspace /var/lib/jenkins/jobs/hello-world-1/workspace
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://github.com/my_company/my_project.git # timeout=10
Fetching upstream changes from https://github.com/my_company/my_project.git
> git --version # timeout=10
using .gitcredentials to set credentials
> git config --local credential.username my_user_name # timeout=10
> git config --local credential.helper store --file=/tmp/git2522812195492229039.credentials # timeout=10
> git -c core.askpass=true fetch --tags --progress https://github.com/my_company/my_project.git +refs/heads/*:refs/remotes/origin/*
> git config --local --remove-section credential # timeout=10
> git rev-parse refs/remotes/origin/master^{commit} # timeout=10
> git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision a05e77ea9c387fdecea800c3fd7a18c492dc393b (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f a05e77ea9c387fdecea800c3fd7a18c492dc393b
> git rev-list a05e77ea9c387fdecea800c3fd7a18c492dc393b # timeout=10
[workspace] $ /bin/sh -xe /tmp/hudson158010815501794039.sh
+ cd /var/www/public_html/my_project
+ git pull origin master
error: cannot open .git/FETCH_HEAD: Permission denied
Build step 'Execute shell' marked build as failure
Finished: FAILURE
我缺少什么? 如何添加用户以运行Jenkins?
config.xml中
<?xml version='1.0' encoding='UTF-8'?>
<project>
<actions/>
<description></description>
<keepDependencies>false</keepDependencies>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github@1.15.0">
<projectUrl>https://github.com/my-company/my-projetc/</projectUrl>
<displayName></displayName>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
</properties>
<scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.1">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<url>https://github.com/my-company/my-project.git</url>
<credentialsId>ca9508ae-c502-405b-8d08-120435a3901b</credentialsId>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>*/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
<submoduleCfg class="list"/>
<extensions/>
</scm>
<canRoam>true</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers>
<com.cloudbees.jenkins.GitHubPushTrigger plugin="github@1.15.0">
<spec></spec>
</com.cloudbees.jenkins.GitHubPushTrigger>
</triggers>
<concurrentBuild>false</concurrentBuild>
<builders>
<hudson.tasks.Shell>
<command>cd /var/www/public_html/my_project
git pull origin master
composer install</command>
</hudson.tasks.Shell>
</builders>
<publishers/>
<buildWrappers/>
我将用户jenkins添加到不同的组。此外,在我的项目文件夹所属的组中。 这可能是什么问题?
答案 0 :(得分:0)
与Github的连接似乎没问题。
在Git SCM插件完成Git之后,你是否试图跳转到这个文件夹?
cd /var/www/public_html/my_project
然后做一个:
git pull origin master
Jenkins似乎没有此文件夹中的权限,我不确定这是您要提取代码的目标文件夹。