12

We have a project that has a private repo. I have access to this repo as I can git clone, etc. for that repo.

However, pod install on this same repo always asks for my login credentials, getting the following message:

remote: Repository not found.
fatal: Authentication failed for 'https://github.com/TEAM/Pod.git/'

I am using an ssh connection. I wouldn't think that the issue is related to this as, like I mentioned, I can clone/pull/etc. successfully.

It is also worth noting that two other's on the team are able to pod install and pod update without any issues.

I've also wiped my credential-osxkeychain.

Thoughts? I'm running out of ideas.


Added details:

I can pod install in the Podfile, but this is for a Cocoapod we are creating, and the pod I'm having issues with is a dependency for this pod. Therefore in the Podfile we have put

#source 'https://github.com/TEAM/PodSpecs.git'
#source 'git@github.com:TEAM/PodSpecs.git'

where only one of those is uncommented (but neither work for me -- though both work for them).

And then in the Podspec we have

s.source = { :git => 'https://github.com/TEAM/PodSpecs.git'}

We have even tried:

s.source = { :git => 'git@github.com:TEAM/PodSpecs.git'}

I have also done the following command and verified the existence of the repo in ./cocoapods/repos:

pod repo add Pod git@github.com:TEAM/PodSpecs.git
EndersJeesh
  • 427
  • 1
  • 4
  • 20
  • Please have a look https://stackoverflow.com/questions/37813568/git-remote-repository-not-found/37814228. There are couple of solutions, it might help you. – Sateesh Yemireddi Nov 08 '18 at 18:12
  • Thanks @Sateesh for the suggestion. Sadly none of the solutions are working for me in there. – EndersJeesh Nov 08 '18 at 18:31

2 Answers2

13

In your Podfile instead of pointing to your private github repository via the https protocol use the git one:

pod 'MyPrivatePod', :git => git@github.com:<username>/myprivatepod.git

To avoid to type your password of your private key each time, be sure you've added it to your opened session. If you are on MacOS:

ssh-add ~/.ssh.id_rsa
Yannick Loriot
  • 7,107
  • 2
  • 33
  • 56
  • Sorry, I've now added more description. The first line of code could get the pod installed. However this is for a Pod that we ourselves are creating and so needs to be provided in the PodSpec as a source, or the linter will not be able to find the repo. Sorry for not including these details initially. And the proper id_rsa file has been added since `git clone` etc. work -- unless there is a way to specify to Cocoapods specifically what to use (outside of credentials-osxkeychain, that is)? – EndersJeesh Nov 08 '18 at 20:29
  • I've updated the description now to include that information. – EndersJeesh Nov 08 '18 at 20:43
0

I had the similar issue, when I started using new laptop. I could do the git clone for repo but pod install and pod update were not working for Cocoapod repo we created.

doing following this worked for me:

  1. generating new ssh key for new laptop. https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
  2. adding newly generated ssh key to GitHub. https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
GoGreen
  • 182
  • 1
  • 13