barndog
barndog

Reputation: 7183

Xcode Bots and Private Cocoapods

I've been attempting to setup Xcode CI with my private cocoapods (I have 3, 2 private, 1 public).

I have a simple run script:

export LANG=en_US.UTF-8
export PATH="/usr/local/bin:$PATH"
cd "$XCS_SOURCE_DIR/myproject"

if [ -e "Pods" ]
then
pod update --verbose
else
pod install --verbose
fi

and I made sure to update my project repository as well as the pod repos to have a remote of the style [email protected]:username/repo.git.

Every time I run an integration, I get the following error:

Update all pods
  Preparing

Cloning spec repo `myproject` from `https://github.com/busycm/CocoapodsPrivateSpecs.git`
  $ /usr/local/bin/git clone https://github.com/busycm/CocoapodsPrivateSpecs.git myproject
[!] Unable to add a source with url `https://github.com/busycm/CocoapodsPrivateSpecs.git` named `myproject`.
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.

/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/sources_manager.rb:48:in `rescue in find_or_create_source_with_url'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/sources_manager.rb:53:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/installer/analyzer.rb:623:in `block in sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/installer/analyzer.rb:622:in `map'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/installer/analyzer.rb:622:in `sources'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/installer.rb:129:in `resolve_dependencies'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/installer.rb:105:in `install!'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/command/project.rb:71:in `run_install_with_update'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/command/project.rb:156:in `run'
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:312:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/lib/cocoapods/command.rb:48:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0.beta.4/bin/pod:44:in `<top (required)>'
/usr/local/bin/pod:23:in `load'
/usr/local/bin/pod:23:in `<main>'
  Cloning into 'myproject'...
  fatal: could not read Username for 'https://github.com': Device not configured

The error suggests there some ssh authentication issue but what's curious to me is that even though all the repositories are set to use ssh, all the cloning in the log is being done via https.

Anyone ever seen anything like this before?

Upvotes: 1

Views: 378

Answers (1)

Lindsay Landry
Lindsay Landry

Reputation: 4917

Xcode Server has a separate user that runs bots, called _xcsbuildd. This user might need its own SSH public and private keys. I had to generate these to use Cocoapods correctly.

First in you server's terminal, sudo as _xcsbuildd user:

sudo -s -u _xcsbuildd

Then, generate SSH keys in the directory /var/_xcsbuildd/.

ssh-keygen -t rsa -C "example_name_here"

Within /var/_xcsbuildd/.ssh/ you should see a file called id_rsa.pub. Copy its contents into a new SSH key for your github user.

Finally, ssh into [email protected] to verify your RSA fingerprint:

ssh -T [email protected] (reply "yes" when asked to verify your fingerprint here)

Then rerun your bot, hopefully this fixes your problem.

Upvotes: 1

Related Questions