Tony Wolski

Random 'Permission denied (publickey)' error in Travis


This morning I hit a random issue in Travis (Pro), in that all of a sudden a build could not clone a GitHub repository:

Installing an SSH key from: default repository key
Key fingerprint: 5e:fd:38:1f:01:e2:f0:87:8e:77:91:e7:70:37:c0:14

$ git clone --depth=50 --branch=my-branch [email protected]:my-organisation/my-repo.git my-organisation/my-repo
Cloning into 'my-organisation/my-repo'...
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.
The command "eval git clone --depth=50 --branch=my-branch [email protected]:my-organisation/my-repo.git my-organisation/my-repo" failed. Retrying, 2 of 3.

I had no idea why this was occurring. As far as I knew nobody had changed any of the settings on GitHub. And all previous builds had succeeded (or failed for other, valid reasons).

I did a quick inspection and suspiciously there were no deploy keys:


Strange. I could have sworn Travis adds a deploy key when you sync a repository. I went to the Travis CI profile page and turned off the repository in question and then back on again.


After doing so and kicking off the build again everything seemed back to normal. The build worked, and there was a deploy key in the GitHub repository settings.



Your thoughts? I'd love to hear them. Please get in contact.