How to integrate sourcetree for gitlab

I worked on github and integrated it to sourcetree (MAC version) for one of my project. I would like to use sourcetree for GITLAB. But I am not able to add remote of gitlab to source tree. In Repository settings, Only I can see host type as "unknown", "bitbucket", "github" & "stash". I used unknown but it won't help me.

Sourcetree Version 2.0.4 (2.0.4)

enter image description here


Solution 1:

This worked for me,

Step 1: Click on + New Repository> Clone from URL

Step 2: In Source URL provide URL followed by your user name,

Example:

  • GitLab Repo URL : http://git.zaid-labs.info/zaid/iosapp.git
  • GitLab User Name : zaid.pathan

So final URL should be http://[email protected]/zaid/iosapp.git

Note: zaid.pathan@ added before git.

Step 3: Enjoy cloning :).

Solution 2:

If you have the generated SSH key for your project from GitLab you can add it to your keychain in OS X via terminal.

ssh-add -K <ssh_generated_key_file.txt>

Once executed you will be asked for the passphrase that you entered when creating the SSH key.

Once the SSH key is in the keychain you can paste the URL from GitLab into Sourcetree like you normally would to clone the project.

Solution 3:

Using the SSH URL from GitLab:

Step 1: Generate an SSH Key with default values from GitLab.

GitLab provides the commands to generate it. Just copy them, edit the email, and paste it in the terminal. Using the default values is important. Else SourceTree will not be able to access the SSH key without additional configuration.

STEP 2: Add the SSH key to your keychain using the command ssh-add -K.

Open the terminal and paste the above command in it. This will add the key to your keychain.

STEP 3: Restart SourceTree and clone remote repo using URL.

Restarting SourceTree is needed so that SourceTree picks the new key.

enter image description here

STEP 4: Copy the SSH URL provided by GitLab.

enter image description here

STEP 5: Paste the SSH URL into the Source URL field of SourceTree.

enter image description here

These steps were successfully performed on Mac OS 10.13.2 using SourceTree 2.7.1.

enter image description hereenter image description here

Solution 4:

Sourcetree 3.x has an option to accept gitLab. See here. I now use Sourcetree 3.0.15. In Settings, put your remote gitLab host and url, etc. If your existing git client version is not supported any more, the easiest way is perhaps to use Sourcetree embedded Git by Tools->Options->Git, in Git Version near the bottom, choose Embedded. A download may happen.

Solution 5:

It worked for me, but only with https link in repository setting (Repository => Repository Settings). You need to change setting to:

URL / path: https://**********.com/username/project.git
Host Type - Stash
Host Root URL - your root URL to GitLab (example:https://**********.com/) 
Username - leave blank

or in some cases if you have ssh url like:

[email protected]:USER/REPOSITORY.git

and your email like:

[email protected]

then this settings should be work:

URL / path: https://test%[email protected]:USER/REPOSITORY.git