18
votes

I am having troubles when I connect with my repository through Xcode.

I have a Gitlab version (full pre-)installed on TurnkeyLinux Virtual Appliance on a remote server. In the Gitlab Web interface, I've created a new test user: "testuser" with a password "password" and a new project "testproject". This user was assigned to this project.

The git url project are:

HTTP: http://example.com/testuser/testproject.git
SSH: [email protected]:testuser/testproject.git

I can see the repositories folder rightly created with a "Terminal" through SSH connection.

Now, I want add this git repository to my Xcode repositories.

So, In

XCode > Preferences > Account     

I'm trying add it, using both urls and my user credentials, but always receive the following message:

"Authentication failed because the name or password was incorrect."

Could anyone help me?

6

6 Answers

28
votes

The user/password would only be needed for an http url, not an ssh one.

When using the http url to add a repo in your XCode Accounts, make sure there is no proxy which would prevent the resolution of the example.com server.

If it is still not working, then, as in "Authentification issue when pushing Xcode project to GitHub", try to use an url like:

https://testuser:[email protected]/testuser/testproject.git
3
votes

Even if the problems seems solved I've found this question when I had the problem using XCode 10. I tried logging in to GitHub and got the same error. The workaround described didn't fix my problem but I've found another solution on my own which I'd like to share – maybe it helps somebody ;)

My GitHub password included an 'ä' character (I'm German) and seems XCode and GitHub don't support the used encoding. After changing my password to something without an 'ä' it worked fine. Maybe it wasn't because of the 'ä' but it already helped to change the password - I don't know.

2
votes

Thank you, but the reasons are Xcode seems a little crazy…

In

Xcode > Source Control > Test Project (master) > Configure Test Project…

I've just added my repository HTTP URL and credentials were not needed, and when I trying push/pull actions Xcode ask me for user/password.

Seems to be Repository in Preferences > Account doesn't work fine…

1
votes

you'd better use the project configuration:
‘Source Control’ > ’(project name)-Master’ > ‘Configure (project name)’,
select ‘Remote’, choose ‘+’ > Add Remote
 Name : origin
 Address : [email protected]:xxx/yyy.git
(Curiously it appears after this in the XCode prefs)

Don't forget: using SSH, the password is the one you used (keygen) when building the key !

0
votes

I don't want to use HTTP! Key file under "git" user is very convenient and secure, I'm not going to type my password in a unencrypted URL entry in some plist file.

In my case, the problem was that Xcode was trying to use the wrong key file :

.ssh/id_rsa
.ssh/id_dsa
0
votes

Here using Xcode 7.3.1 and finally managed to push using ssh (and Gogs as github server) by doing so:

1) select the correct private key (there must also be the public key file present)

on Gogs side:

2) add that same key from the Gogs user Settings->SSH Keys

3) under admin panel: Dashboard: Operations: rewrite the authorised_keys file

Done