How do I configure SourceTree to clon my GitLab repo(s)?
I donāt think you can right now, @ospena2020. Not unless you request GitLab integration to be added by requesting it on Atlassianās SourceTree issue tracker.
Seems that gitlab support is planned for sourcetree 1.8.1
https://jira.atlassian.com/browse/SRCTREE-1037?src=confmacro
So Iāve read: Configure SourceTree
Since then has there been any word that this is going to happen or not?
@ospena2020, @KamranMackey, and @haynes,
While Sourcetree doesnāt yet have automatic wizard-like support of gitlab, you can already set it up to work perfectly with gitlab, or any other git server that runs over ssh or https. Hereās how you do it:
Step 1: Browse to your repo and copy the SSH or HTTPS address. I recommend SSH for Sourcetree.
Step 2: Click the Clone / New button.
Step 3: Type or paste the repo address into the Source Path / URL box. Choose where you want to store it locally in the Destination Path box. Click the Clone button.
Step 4: Enjoy your freshly cloned repo with an origin remote already set up for you.
I have found that cloning using the https url works fine but I have not succeeded in getting the ssh url to work. I keep getting the error message āThis is not a valid source path / URLā. Under Details it says āFATAL ERROR: Network error. Connection timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.ā. I have followed the instructions to create a public / private key installed on the GitLab and SourceTree respectively using a 1024 RSA, 2048 RSA Puttygen key/pair and a openssh key/pair restarting Pageant SSH agent in between to no avail.
Any advantage to using SSH over HTTPS for the cloning? If not Iāll stick with HTTPS as it works fine. Just curious why the SSH option was failing. Thanks in advance to anyone who solves this
SSH is generally faster from what I understand. If it works both directions with HTTPS and you donāt care, stick with it. If you want SSH to work, make sure you have read and/or write access to the repo youāre trying to clone. If itās just a public project and you arenāt a member of it, HTTPS is probably all youāll get. If you own the project or are a member of it you should have no issues with the SSH version.
Cheers for the helpā¦at some point Iāll sort out why the ssh doesnāt work and post the outcome here for others. Iāll certainly look to your suggestion that the permissions are the issue as my first item to re-check so thanks for that
I was able to clone a repo via https however what about multiple gitlab accounts with sourcetree?
Hmm I am using SourceTree 1.6.1 on Win7 against a gitlab 8.0.4 installed on RHEL 6 but the HTTPS fails.
When trying to clone with http SourceTree spews following error
Couldnāt find host git.****.tld in the _netrc file; using defaults ā¦
We have our own CA certs and I configured it correctly in the curl-ca-bundle.crt. Testing this with git 1.9.5 command lines works all fine.
The sourcetree details show that it is opening to port 443 ok then picking up the CAFile fine but then it starts talking about Unknown SSL protocol error in connection to ā¦ Closing Connection 0
Did anyone ever experience something like this with SourceTree?
Thanks Niels
Answering my own question ā¦ turns out the embedded git version 1.9.5 of SourceTree does not work with gitlab and the multiple 302 redirects one is getting when using the https scheme. Selecting a system installed git version (in my case 2.5.0) works as far as I can tell.
Initially when I tried to Fetch from a Gitlab remote in SourceTree, I got error messages like this:
git -c diff.mnemonicprefix=false -c core.quotepath=false fetch origin
Access denied
Access denied
Access denied
Access denied
FATAL ERROR: Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures for git"
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Completed with errors, see above.
This was running Source Tree 1.6.something and 1.7.0, with the remote hosted in GitLab Community Edition version 8.1.4.
It turned out my issue was to do with the SSH Client Configuration (the āaccess deniedā and āToo many authentication failures for gitā messages were the big clues). I made two changes in Tools > Options which fixed this:
- Changed SSH Client to OpenSSH, instead of the default PuTTY/Plink
- Set a path to my SSH key file.
After these two changes, fetching, cloning and pushing to my remotes all work fine.
If you want this, vote for the pluggable service APIāitād let SourceTree support GitLab and any others:
Jira ticket for the Mac version of SourceTree is here: https://jira.atlassian.com/browse/SRCTREE-636
The SourceTree ticket is from five years ago, no action since then.
It doesnāt look that this will ever be implemented by Atlassian.
Why support their (more capable) competitors?
How to setup Sourcetree with two factor authentification(2FA)?
Iām strugglingā¦
Iāve setup an access token on Gitlab, but donāt know how to use it in Sourcetree
I recommend you take a look at the article GitHub vs BitBucket vs GitLab to know, which one is the best
Switching to OpenSSH was incredibly helpful! Thank you so much for posting.
- Open SourceTree
- Tools > Options
- On the
General
tab change SSH client toOpen SSH
. - Your SSH key field should auto-populate (if it doesnāt you may need to follow these instructions).
@sepp54 We also just turned on 2FA and Iām having the same issue you did. Were you ever able to find a solution?
@sepp54 @uythoang have you tried putting the token in the password field? I guess it works the same as GitHub https://confluence.atlassian.com/sourcetreekb/two-factor-authentication-2fa-with-github-in-sourcetree-402033499.html.