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?

Brian Boyle
  • 2,849
  • 5
  • 27
  • 35

1 Answers1

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 'git@bitbucket.org: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.

sgvd
  • 3,819
  • 18
  • 31
  • I get this Warnings: Git SSH URLs will NOT work for people behind firewalls configured to only allow HTTP, therefore HTTPS is preferred. – Michal Shatz Mar 26 '15 at 09:08
  • 1
    If you're forced to use https, you can use the following to prevent having to give credentials: `source 'https://username:password@bitbucket.org/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. – sgvd Mar 26 '15 at 09:59
  • Why am I forced to use https? – Michal Shatz Mar 26 '15 at 10:21
  • 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. – sgvd Mar 26 '15 at 17:15
  • Nice. Worked for me. Thanks – bandejapaisa Nov 19 '15 at 21:37