Cocoapods - Specify Source Repo Username
Asked Answered
P

1

11

Using Cocoapods v0.34.4

My Podfile contains the following

source 'https://bitbucket.org/MyRepo/My-podspecs.git'
source 'https://github.com/CocoaPods/Specs.git'

When I run pod install I need to specify a username/password for my bitbucket account. This is fine when I am running locally, however I am also running this as part of a Continuous Integration build with XCode Server and XCode 6. On XCode Server the pod install command fails because it cannot access bitbucket without my credentials.

Is it possible to add my credentials to the Podfile or any other way to tell Cocoapods the credentials for the bitbucket source repo?

Pforzheim answered 24/10, 2014 at 11:12 Comment(0)
F
5

You can use the Bitbucket SSH URL instead of the https URL, and set up passwordless SSH by using an SSH key.

Change your Podfile:

source '[email protected]:MyRepo/My-podspecs.git'

And follow BitBucket's instructions here to set up an SSH key and add it to your Bitbucket account. Make sure you give an empty password when creating your key/identity. For instance, in step 3.4 of their instructions for OSX/Linux, just press enter twice.

Foust answered 24/10, 2014 at 11:28 Comment(4)
I get this Warnings: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred.Maritamaritain
If you're forced to use https, you can use the following to prevent having to give credentials: source 'https://username:[email protected]/MyRepo/My-podspecs.git'. However, this is rather insecure, as you're putting your credentials in a plain text file, which is probably put under version control and visible to anybody who has access to it.Foust
Why am I forced to use https?Maritamaritain
I am not saying you are, I was just saying what you can do if you are. Does the installation fail, or does it just give the warning but still install it correctly? If it fails, looks like you are limited to using https like I said above, and you should ask your sysadmin why you're limited like that. If it doesn't fail, you have no issue :) If you run into another problem, best to open a new SO question.Foust

© 2022 - 2024 — McMap. All rights reserved.