Search code examples
iosxcodessh-keysosx-serverxcode-server

Xcode Server 4.0 git push from build trigger script


I installed an Xcode Bot for a project that is hosted on github. I followed the steps and setup bot to use my existing SSH key. The verification succeeds and the project will checkout and build.

I then added a shell script in the pre-trigger action that increments the version in the plist, tags it, and commits that change back to github.

However when I try to do a git push from the shell script I get this:

-- Pushing to [email protected]:spex-app/spex-ios.git Permission denied (publickey).

fatal: Could not read from remote repository.


Why would the server successfully checkout my project but not be able to push changes. I notice the user is _xcsbuildd. I tried copying the .ssh keys into that /var/_xcsbuildd/.ssh and that also does not work.


Solution

  • I figured it out. You need to create new keys for the _xcsbuildd user. Then add them to github. Bottom of this thread: https://devforums.apple.com/message/1054122#1054122

    sudo -u _xcsbuildd /bin/bash
    ssh-keygen -t rsa -C "[email protected]"
    ssh -T [email protected]