Search code examples
iosxcode7twitter-fabric

xcode 7.3.1 can't connect to git


I am using Xcode 7.3.1. on Mac El Capitan. I have cloned a project from its repo in terminal but when I try to add a repository using Xcode - Preferences -> Accounts I get authentication failed. The same happens when I try Source Control -> Checkout.

I am following the instructions here: https://docs.fabric.io/apple/beta/beta-walkthrough.html#add-udid

I have tried both gitosis@myserver:myproject.git and ssh://gitosis@myserver:myproject.git.

In terminal, git clone gitosis@myserver:myproject.git works fine.

I do have git-flow in this repo, could that upset xcode? I have tried just checking out master branch and using that with xcode but it didn't make any difference.

Another possible problem is that my git config file sets a port different to 22 and it may be that xcode does not pick this up from the config file and uses port 22 regardless?


Solution

  • I finally fixed this by entering the git connection string as ssh://myserver.com:2245/my-project.git.

    Xcode apparently does not read my config file which was evident when it prompted me for the default certificate id_rsa instead of the one specified for the named server, together with the port specified in my ~/.ssh/git/config file.

    I hope this helps somebody not to waste a couple of days as I did.