Access to other repositories fails during build

Some builds require access to other private repositories for example to use as a dependency. Codeship creates a SSH key pair for each project when you first configure it. You can view the public key on the General page of your project settings and it gets automatically added as a deploy key to your GitHub or BitBucket repository.

If you need access to other (private) repositories besides this main repository, you need to follow these steps:

  1. Remove the Codeship deploy key from the main repository
  2. Create a machine user
  3. Add the public key from your projects General settings page to the machine user (this is the key that was previously added as a deploy key)
  4. Add the machine user to both repositories on GitHub.

Even though we reference only GitHub above, the procedure is the same when your project is hosted on BitBucket.

As an alternative you can also add the SSH key from the Codeship project to your personal GitHub / BitBucket user account instead of a machine user. Keep in mind that this will allow the project to access any repository which you are allowed to access on those services.

Typical error messages for this error

remote: Repository not found
fatal: Could not read from remote repository
Permission denied (publickey).