【问题标题】:access denied when cloning local git from Jenkins从 Jenkins 克隆本地 git 时访问被拒绝
【发布时间】:2012-06-09 23:40:39
【问题描述】:

我在本地 linux 机器上使用 Jenkins。 我有一个本地 git 存储库,它也使用 bitbucket 作为其来源。

我正在尝试让 Jenkins 从本地 git 存储库构建,但每次构建时,都会出现以下错误:

Started by user Hippyjim 
Building in workspace /var/lib/jenkins/workspace/Staging
Checkout:Staging / /var/lib/jenkins/workspace/Staging - hudson.remoting.LocalChannel@15c0729
Using strategy: Default
Checkout:Staging / /var/lib/jenkins/workspace/Staging - hudson.remoting.LocalChannel@15c0729
Fetching changes from 1 remote Git repository
Fetching upstream changes from /home/hippyjim/PhpstormProjects/myRepo/.git
ERROR: Problem fetching from origin / origin - could be unavailable. Continuing anyway
hudson.plugins.git.GitException: Error performing command: git fetch -t /home/hippyjim/PhpstormProjects/myRepo/.git +refs/heads/*:refs/remotes/origin/*
Command "git fetch -t /home/hippyjim/PhpstormProjects/myRepo/.git +refs/heads/*:refs/remotes/origin/*" returned status code 255: error: cannot open    .git/FETCH_HEAD: Permission denied

如果我运行它在错误消息中给出的克隆命令,它工作正常。我只需要 Jenkins 来获取这台本地机器上的更改,以便能够部署我的代码。我完全被困在这里 - 有人有什么想法吗?

【问题讨论】:

  • Jenkins 以什么用户身份运行?它正在从 /home/hippyjim/PhpstormProjects/myRepo 克隆(和获取)到其他地方进行构建?
  • 是的,同意“权限被拒绝”错误表明这是用户访问问题
  • 感谢 user37078 和 Mark O'Connor - 这权限问题。我试图让我的 jenkins 从我的本地(非裸)repo 副本构建克隆,而不是从 bitbucket 克隆。由于它位于 Jenkins 用户无权访问的文件夹中,因此它失败了。更复杂的是,我自己克隆了 repo,所以它在工作区中有一个 repo 的副本,它无法访问。我清理了工作区,让它从 bitbucket 克隆,一切都很好。如果你们当中有人想添加答案,我会接受。
  • 提醒:伙计们——除非真的有答案,否则我不能接受这个问题的答案
  • 请关闭这个问题,因为它已经回答了!

标签: git deployment jenkins


【解决方案1】:

结合 user37078 和 Mark O'Connor 的答案:

  • Jenkins 以什么用户身份运行?
  • 是否从 /home/hippyjim/PhpstormProjects/myRepo 克隆(和/或获取)到其他地方进行构建?
  • “权限被拒绝”错误表明这是用户访问问题

【讨论】:

    猜你喜欢
    • 2020-04-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-18
    • 2017-10-30
    • 2016-09-22
    • 2016-05-18
    • 1970-01-01
    相关资源
    最近更新 更多