Git repository checkout fails when using native Git executable


アトラシアン コミュニティをご利用ください。



When trying to use native Git executable, Bamboo gives a permission denied error:

Executing Task 'Checkout Default Repository(2)' of type com.atlassian.bamboo.plugins.vcs:task.vcs.checkout.(java.lang.RuntimeException : 
com.atlassian.bamboo.repository.RepositoryException: Cannot fetch branch
 '(unresolved) 963c55456144b9549c2ea196c68b89f47982368e' from '' to source directory '/var/bamboo-home/xml-data/build-dir/PROJ1-PLAN1-JOB1'. command /usr/bin/git ls-remote ssh://f20b0a52-1011-4674-86a2-3a58d47f22d6@ failed with code 128. Working directory was [/var/bamboo-home/xml-data/build-dir/PROJ1-PLAN1-JOB1]., stderr: [fatal: cannot exec '/tmp/': Permission denied, fatal: unable to fork])

NOTE: Bamboo is running as root, and /usr/bin/git is owned by root and has "rwxr-xr-x" permissions.


The /tmp directory on your server is a mount point. That mount point has 'noexec' set on it. That's where the 'Permission denied' error is coming from.


If noexec must remain set on the mount for /tmp, you can override the temp directory location to another path does have execute permissions.

  1. Edit the $HOME/bamboo-agent-home/conf/wrapper.conf
  2. Add an additional parameter to override tmpdir. Example below:<path>/bamboo-agent-home/<path>/bamboo-agent-home/temp

    • Note, must be numbered sequentially for the argument to be read. In this default example, both 3's are commented out so we need to re-use it for the tmpdir but your configuration might be different.
  3. Restart the agent.


Here are the investigation steps leading to the solution.

Temporarily set the GIT_SSH environment variable to point to /tmp/ file and try to run normal Git clone procedure from command line. It might be useful to edit the /tmp/ file and, for example, cut the 'exec' from the beginning to see how the Git checkout will behave:

ssh -o StrictHostKeyChecking=no -o BatchMode=yes -o UserKnownHostsFile=/dev/null $@

Here is the result of a Git clone from command line after changing the GIT_SSH environment variable and trying to clone:

[root@server tmp]# git clone $GIT:product
 Cloning into 'product'...
 fatal: cannot exec '/tmp/': Permission denied
 fatal: unable to fork
 [root@server tmp]# ./ 
 -bash: ./ /bin/sh: bad interpreter: Permission denied

If /bin/sh is set correctly, and script is owned by root and has at least 755 permissions, then 'Permission denied' error means a system-level issue (when running the script as root).

After running the following command you will see that the /tmp directory is a mount (and has 'noexec'):

[root@server tmp]# mount | grep tmp
 /dev/mapper/Vol00-Log01 on /tmp type ext3 (rw,noexec,nosuid,nodev)

Edit /etc/fstab and remove 'noexec' (and nosuid), then reboot the Bamboo server and try to checkout again.

最終更新日 2018 年 11 月 19 日


Powered by Confluence and Scroll Viewport.