Multiple Github SSH keys

Skip to first unread message

Krzysztof Grobelny

Dec 19, 2021, 1:54:13 PM12/19/21
to CocoaPods
Hi all,

we've got private specs repo in our company:

It is defined as a source in one of the projects Podfile:
source ''

So far so good, everything works fine.

However on my machine I've got multiple Github accounts configured, with separate config keys. SSH config file looks like this:
Host github-TheCompany
        User git
        IdentityFile ~/.ssh/github_thecompany

Host github-TheOtherCompany
        User git
        IdentityFile ~/.ssh/github_theothercompany

Having that in mind, I'm changing the aforementioned Podfile and the source there to:
source 'git@github-TheCompany:TheCompany/our.Specs.git'

And it fetches those specs, I can find them in ~/.cocoapods/repos

The problem appears when I try to use any pod defined in those specs.
I'm getting the following error:
[!] Error installing SomePod
[!] /usr/bin/git clone /var/folders/0v/w8vn6fyj0dz9kz77xlcpqhw00000gn/T/d20211219-51148-9l06b2 --template= --single-branch --depth 1 --branch 2.5.0

Cloning into '/var/folders/0v/w8vn6fyj0dz9kz77xlcpqhw00000gn/T/d20211219-51148-9l06b2'... Permission denied (publickey).
fatal: Could not read from remote repository.

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

Clearly the github-TheCompany host is not respected in all pods defined in those specs.
In that particular case, when I check what has been fetched to ~/.cocoapods/repos, the source is:
s.source           = { :git => "", :tag => s.version.to_s }

Can anyone tell me how to resolve that problem? What's the root cause - my local config or the way specs are defined in the repo?

Any advices would be appreciated.

Many thanks!
Reply all
Reply to author
0 new messages