11 Replies
      Latest reply on Dec 14, 2017 11:03 AM by Terry H
      Dave G Level 1 Level 1 (0 points)

        Is anyone else having difficulty accessing a remote repository via SSH in Xcode 7?


        I have all my projects under GIT source control with a remote repository on an OS X Server.  In Xcode 6.x I can connect to the remotes via SSH keys without any problems.  My server has SSH password authentication turned off.


        In Xcode 7 when I set up the remote repository in preferences, using the slightly changed setup dialog that now includes a specific SSH option, I receive an "Authentication Failed" message.  Xcode 7 shows the correct server fingerprint the first time I attempt to connect.  And, on the server side, I can see in the log where the SSH daemon accepted the incoming public connection.


        I've tried a number of fixes without success:


        1. Removed all existing remote repository information from both Xcode 6 and Xcode 7


        2. Deleted Xcode 6 entirely from my computer, and removed the com.apple.dt.Xcode.plist file in /~/Library/Preferences/


        3. Created an entirely new private/public keypair and selected them in the Xcode remote repository setup dialog.


        Any ideas would be appreciated!  (Bug Report is next on my list)



        • Re: Unable to connect to remote repository via SSH in Xcode 7
          gveres Level 1 Level 1 (0 points)

          Exactly the same case as you. Git integration seems completely busted in xcode 7.


          The OS just updated to xcode 7 automatically on me. When I was on xcode 6, I could connect to the git server. As soon as I updated to xcode 7, the exact same config stopped working.


          I have been trying for an hour or two on my laptop (seperate machine), starting from scratch, ensuring that my passphrase is entered correctly. Nothing works. This is a major regression. How could they have so many betas and not catch this.


          I am using a git server on a synology NAS. I require ssh keys. Everything works perfectly from the command line. xcode preferences for adding a remote repository just keeps saying authentication failed. And for the project that already has the remote repository created, I get a "failed to connect to nas: connection refused (-1)" error.



            • Re: Unable to connect to remote repository via SSH in Xcode 7
              neil456 Level 1 Level 1 (10 points)

              Just so you know, there is another thread here describing git repositories (local file system) as broken without SSL.  Same problem as you describe and also happened with the install of Xcode 7 GM.  Xcode 7 beta 6 worked fine.  Also broken with Xcode 7.1 Beta 1


              EDIT: https://forums.developer.apple.com/thread/17473



              • Re: Unable to connect to remote repository via SSH in Xcode 7
                rob-secondstage Level 1 Level 1 (0 points)

                I tried disabling SSH on my Xcode server and only using HTTPS to access my git repositories. The same issue exists there.


                Interestingly this seems to work for me on my Yosemite machine, but fails on a clean install of El Capitan GM seed. The Yosemite machine was using Xcode 6 before it upgraded to Xcode 7. I'm not sure if the upgrade has anything to do with it working there or not.


                I will continue to try different approaches to see if I can get anything to work. This is maddening.

                  • Re: Unable to connect to remote repository via SSH in Xcode 7
                    rob-secondstage Level 1 Level 1 (0 points)

                    I was able to get this working, but honestly, I'm not sure how. I'll outline what I did. Maybe it will help someone else.


                    I copied a folder with my project from my Yosemite machine (where this was working) to my El Capitan machine.

                    When I tried to add the repo in the Xcode account preferences on El Capitan, it failed as noted above.

                    When I tried to push changes from the Xcode Source Control menu, it also failed (never got past preparing to push...)

                    However, when I made a source change and chose "Commit" from the Xcode Source Control menu and then clicked the "push to remote" checkbox in the lower left corner, it worked! It asked me to authenticate, and that worked fine. It also added the repo to the Xcode account prefs.


                    Honestly I don't know if this has anything to do with copying an existing project folder and using that. But, it seems once I committed a change, all is good again. I can connect to other repos on the same server and pull them down.


                    There might be something else I did as I was getting frustrated and trying a bunch of stuff. Sorry that I didn't capture it all.


                    I hope this helps. Clearly Apple needs to fix this.

                  • Re: Unable to connect to remote repository via SSH in Xcode 7
                    rboerdijk Level 1 Level 1 (0 points)

                    I had a very similar issue with my synology-NAS: "Failed to Start SSH session: Unable to exchange encryption keys(-1)".


                    Basically XCode and the NAS can't agree on which "encryption algorithms" to use. I'm quite the Linux-noob, so it took me 1/2 of the weekend, but I got it working and posted it here: http://stackoverflow.com/questions/32833100/adding-a-github-repository-in-xcode-7-using-ssh-authentication-gives-an-authenti/33985629#33985629


                    Since this post here on the apple-forum got me started, I though I'd post the link here, maybe it'll help someone get it working.

                  • Re: Unable to connect to remote repository via SSH in Xcode 7
                    mcf Level 1 Level 1 (10 points)

                    In my case, Xcode was having problems with the repository called


                    I edited the local Project/.git/config by hand (naughty, probably should have used git config) to read


                    while Xcode was not open, then reopened the project and Push'ed and all was fine after re=-authenticating.


                    I believe, from the error message I was getting ('/~myuser/... is not a repository') that Xcode now leaves in the initial / causing misparsing of the ~



                      • Re: Unable to connect to remote repository via SSH in Xcode 7
                        Dave G Level 1 Level 1 (0 points)



                        Awesome.  Using '~' was the problem for me.  Using the full path with 'Users\username' solved my situation.  Luckily I didn't have to edit any config files - I just deleted and then re-added the repository in Xcode preferences.  I didn't try any other combinations of '~' and '/' to see if Xcode can still parse '~'.  I'm just happy to get it working and not spend extra energy in terminal trying to keep all my remotes up to date!




                      • Re: Unable to connect to remote repository via SSH in Xcode 7
                        mpt Level 1 Level 1 (0 points)

                        I have had the similar issue, after updating to Xcode 7, authentication permanently failing. Interestingly, ssh command from terminal works fine with the same credentials. I was using ssh://username@server/path/to/git or ssh://server/path/to/git, entering name and passwd separately.


                        Then I found somewhere and tried to enter both name and passwd in the URL (ssh://username:passwd@server/path/to/git) and it simply works.