2

I am trying to set up an iOS project on Travis-CI for the first time, and I am having trouble getting travis to add a private pod-spec repo.

I've got a before-script that runs this command:

- gem install cocoapods
- pod repo add MyPrivate-Repo git@github.com:myAccount/MyPrivate-Repo.git
...

However, I am getting this error when travis tries to add my private pod spec repo

Cloning spec repo `MyPrivate-Repo` from `git@github.com:myAccount/MyPrivate-Repo.git`

[!] Pod::Executable clone 'git@github.com:myAccount/MyPrivate-Repo.git' MyPrivate-Repo

Cloning into 'MyPrivate-Repo'...

ERROR: Repository not found.

fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

Now i am very new to this so apologies if I am missing something obvious here.

I am sure that the repository does indeed exist, I tested that by performing a

git clone git@github.com:myAccount/MyPrivate-Repo.git

on my local machine. So that means access rights I assume. How do I go about checking the access rights for that? Travis seems to work fine cloning other repos within the same organization? Any help much appreciated!!

Sean Danzeiser
  • 9,141
  • 12
  • 52
  • 90

1 Answers1

2

It works on your machine, because ssh knows where tyo look for your public/private ssh keys.

But you need to add those keys (or, even better, add a new public/ssh key dedicated to your travis config) to Travis, in order for that environment to be able to authenticate and access your private repo.

See Pushing to github from travis-ci.

Note that you can use travis encrypt in .travis.yml file as in this gist from Luke Patterson (lukewpatterson).

To encrypt the private SSH key into the "-secure: xxxxx....." lines to place in the .travis.yml file, generate a deploy key then run: (to see what the encrypted data looks like, see an example in this .travis.yml.

base64 --wrap=0 ~/.ssh/id_rsa > ~/.ssh/id_rsa_base64
ENCRYPTION_FILTER="echo \$(echo \"-\")\$(travis encrypt veewee-community/veewee-push \"\$FILE='\`cat $FILE\`'\" | grep secure:)"
split --bytes=100 --numeric-suffixes --suffix-length=2 --filter="$ENCRYPTION_FILTER" ~/.ssh/id_rsa_base64 id_rsa_

Ha! it takes 30 lines to squeeze it all in.

That gives something like:

env:
  global:
    - secure: "Y3Ox1GnYemOXPms5qUg//pnJBTh/9/kdnDa8BRXqurMaH6RuADcZnmSLjR7W\ny81/JuXMgToWN/+6zZALZyoYm87qRjjQAKfglA9nuSeXDSPhpERMXaf7RVUI\n8BpQYkmdY/HsQtGci4qqNfifQulp8TS/CpV+Kgx9k5JpulBeFow="
    - secure: "ePKK/XhvRqBiHKFPZdh5rGgupABVQyYUQWvl2uzfqgCRZ6xGIU+ZW89iiL27\n3cSfEL1x1FAXPkpslNOscz4INYgl8+dUvnmwnSuT2b/9ekpeDEhTmC+L06si\n15NLKCK7TUnS3wJ/WkA27ij43X+ArOqsTi2xvTXTPdn4utLjfIM="
    - secure: "C...
    ...
    ...

To reconstitute the private SSH key once running inside Travis: (see example use in this .travis.yml)


Another similar technique in this gist from Douglas Duteil (douglasduteil), which declares in .travis.yml an external script.

before_script: .travis/before_script.sh



echo -n $id_rsa_{00..30} >> ~/.ssh/id_rsa_base64
base64 --decode --ignore-garbage ~/.ssh/id_rsa_base64 > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
echo -e "Host github.com\n\tStrictHostKeyChecking no\n" >> ~/.ssh/config
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Same situation is for me but i am not using any travis just try to add a local project. How to resolve that? – kidsid49 Jul 31 '14 at 07:26
  • @kidsid49 you could create a new question, with a link back to this one, explaining the differences, and detailling your setup (git version, os, ...) – VonC Jul 31 '14 at 07:28
  • Here it is. http://stackoverflow.com/questions/25052755/how-to-add-a-private-spec-repo-for-using-private-pods – kidsid49 Jul 31 '14 at 07:31
  • @kidsid49 great, but I don't see any information there about your setup, version number or error message that you could have had. You need to post a *complete* question for people to help you. – VonC Jul 31 '14 at 07:36
  • Sorry Man. Just edited my answer. I posted the whole terminal command and output. – kidsid49 Jul 31 '14 at 07:40
  • @kidsid49 much better. Still missing the setup info (version of OS, git, other tools), but you are getting there. – VonC Jul 31 '14 at 07:41
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/58403/discussion-between-kidsid49-and-vonc). – kidsid49 Jul 31 '14 at 07:45