ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

Main Area and Open Discussion > General Software Discussion

Resolved(?): How to connect to GitLab using SourceTree?

(1/2) > >>

Deozaan:
This may be a little niche, or too specific to my situation, but I'm having some troubles and figured I'd ask if anyone here had experience or insight on how to resolve them. No worries if this is too specific. I don't expect anyone here to go through the trouble of setting up GitLab and SourceTree just to help me out, though I wouldn't put it past some of you people to be that awesomely helpful. ;)

A Brief-ish History:
Ten years ago a thread started here on some relatively new distributed version control systems called Git and Mercurial (Hg). At the time when I researched them, I wanted to use Git but it wasn't easy to get working on Windows, so I ended up using Hg. So for about the past ten years I've become an old fart, set in my ways, thumbing my nose at Git while more or less happily using Hg with BitBucket and TortoiseHg. That is, until last year when BitBucket dropped support for Hg repositories. :(

For a little while I remained stubborn and hosted my own RhodeCode server but it wasn't ideal because I actually collaborate with at least one other person on a somewhat regular basis and my ISP's upload speed isn't that great and my internet connection kept dropping out frequently, so it wasn't very reliable for others to connect to and use.

As a result, this past December I decided to bite the bullet and convert all my repositories to Git and start using Git from then on. And after doing some research I decided I'd rather be using GitLab than GitHub. So I first used a feature of GitHub to import my Mercurial repositories from my personal RhodeCode server and convert them to Git automatically. Then I used a feature of GitLab to import my GitHub repositories to GitLab.

While I was still using Hg, I was alternating between using TortoiseHg and SourceTree to manage my repositories. That is, I primarily used TortoiseHg, but I felt SourceTree had better integrated using development branches more easily. When I made the move to Git, I obviously had to drop TortoiseHg, but I decided to just keep using SourceTree, which supports both Git and Hg (for now... Atlassian owns BitBucket and SourceTree).

I think I got it all configured and had it working in December so that I could connect with GitLab and push/pull to/from my repositories. But then this year I've kind of taken a break from my usual thing and have just been doing little experiments that I never felt were big or important enough for version control. But now I'm starting to get back into wanting version control and I've run into a problem where I can't seem to get SourceTree to work with GitLab anymore.

The Problem:
Somehow I was able to successfully create a new remote repository from SourceTree, but then I immediately got an error when it tried to push my local repo to it. The error looks something like this:


--- ---remote: HTTP Basic: Access denied
remote: You must use a personal access token with 'read_repository' or 'write_repository' scope for Git over HTTP.
remote: You can generate one at https://gitlab.com/-/profile/personal_access_tokens
fatal: Authentication failed for 'https://gitlab.com/Deozaan/MyCoolRepository.git/'
GitLab has something called "personal access tokens" (PAT) which can be used in place of your password to authenticate third-party apps to work with your account. The UI doesn't make it very clear (IMO) which scopes are needed, and which scopes include the privileges of other scopes, etc. So, while the PAT I created from December had only the "api" scope, the error message says I need "read_repository" and/or "write_repository" so I created a new PAT with all the scopes.


It didn't help. I still get the same error.

I tried changing the URL to use SSH instead of HTTPS, but then it just asks me to load a ppk file which supposedly contains my SSH key. I don't have one of those. Or at least not the right one. I found one on my PC which I thought might be the right one, but when I load it, it just asks me for the SSH password over and over again. So it seems that the password I have stored in my password manager for GitLab SSH key does not match whatever SSH key is in that ppk file.

I do have my SSH private key stored in my password manager, but the putty agent (pageant) which SourceTree uses seems to require PPK format instead of... whatever format I have it stored as. It starts with "-----BEGIN OPENSSH PRIVATE KEY-----" whereas the random PPK file I found where I thought my GitLab SSH key would be starts with "PuTTY-User-Key-File-2: ssh-rsa"

Resolved(?): How to connect to GitLab using SourceTree?

So here I am with two PATs that don't seem to work anymore. Somehow I have saved an incompatible SSH key/password in my password manager. I swear I had this all working fine in December and I don't know what changed in the interim. And I don't know if it's a classic case of PEBCAK, or if GitLab's PATs aren't working right, or if SourceTree is not working properly. I just want to be able to push to and pull from my GitLab repos from SourceTree!

That said, I'm mostly just sticking with SourceTree because I'm already familiar with it and because it's free. If there's an alternative (and free) Git GUI client that works well with GitLab and runs on Windows which would solve my problem, I'd be happy to hear your recommendations on that front, as well. :Thmbsup:

Shades:
Have been using GitExtensions (free/open source) and Fork (paid) successfully with a remote hosted GitLab (enterprise version) for the last 2 years. There is a need to connect with a VPN client to their VPN server first (2FA only), before I can access their GitLab instance. Hence I expect not much of the safety features in GitLab are activated, the VPN barrier is the security.

The above might be an idea for you too, with regards to securing your GitLab instance.

Back to clients, GitExtensions is pretty stable en pretty extensive. However it misses one very important feature. If you do a diff between files, it won't let you do this side by side, just one view where all changes are shown where they happen. Who ever thought that is sufficient or even efficient, has never worked with side by side diff views. But the creators behind GitExtensions are adamant that a side by side diff are not necessary. And they mention: you can link your favorite diff software to do side by side diffs, so GitExtensions opens it for every file that has a change in it. All nice and dandy, if you have small sets of files that contain changes. But that is not the case where I work. Using that method with a few 100 files and you'll know what a hassle this is.

Fork does side by side diffs natively. It also used to be free, but 6 months or so ago they changed their policy and my boss paid up immediately. I have been playing a little bit with: Guitar  which is a free Git client that does side by side diffs, but there does not seem to be editing capabilities within that view. It has other things going for it, though more time is needed to play with it.

A bit of a rant about Atlassian:
Atlassian is a company with an attitude. We use their Jira product. For legal matters we can only use it as an on-premise product. While they first sent out a communication that the Jira on-premise product would still be supported in the future, their most recent communication now simply states that in 2024 all support drops and that there is only the cloud version of Jira available. Although Internet has improved a lot in Paraguay, it still isn't as stable as it should be. So, even if there were no legal bounds (with financial consequences) to consider, cloud solutions are not just as ideal as a solution as an on-premise server is to me.

But this forced move by Atlassian creates more problems than it is worth. So, their stance on other products like SourceTree can also change on a dime. While it is their right to do so, for my particular use-case they screw me over. Ah well, at least they give enough warning, so there is time to look for alternatives.

Ath:
Not sure what kind of tooling/IDE you use for development, but I've been very content using VSCode with the Gitlens plugin. Admittedly, I'm 'only' using it with Github (and TFS/AzureDevOps-Git at work), but Gitlab sounds no more than natural to also being supported.

When you're using the Visual Studio IDE, there is the official Gitlab extension available in the marketplace, adding full Gitlab support to VS20xx.

As a direct alternative to SourceTree, Gitkraken is, AFAICS, free for open source Github and Gitlab repo's, so that could also be an option.

And then there's the 'Classic' TortoiseGIT extension for Windows Explorer, quite similar to TortoiseHg and TortoiseSVN.

wraith808:
I use sourcetree and Pageant so I know your pain about the format of the ppk. I'm not sure since you don't know your password, but you can try to regen with PuttyGen from your openssh key and put in the same password you think you used before to see if that helps you connect via SSH.

https://www.simplified.guide/putty/convert-ssh-key-to-ppk

Deozaan:
It seems that SourceTree was having a temporary brainfart. I realized I had the GitHub Desktop app installed, so I tried it and I was able to use the same PAT I'm using with SourceTree to communicate with my GitLab repositories. After I saw it was working in GitHub Desktop I tried it again in SourceTree and it still didn't work. That was yesterday, but today SourceTree is working for me again. Weird.

A bit of a rant about Atlassian:
Atlassian is a company with an attitude. We use their Jira product. For legal matters we can only use it as an on-premise product. While they first sent out a communication that the Jira on-premise product would still be supported in the future, their most recent communication now simply states that in 2024 all support drops and that there is only the cloud version of Jira available. Although Internet has improved a lot in Paraguay, it still isn't as stable as it should be. So, even if there were no legal bounds (with financial consequences) to consider, cloud solutions are not just as ideal as a solution as an on-premise server is to me.
-Shades (April 13, 2021, 08:18 AM)
--- End quote ---

That's why I didn't go back to BitBucket even after converting my repositories to Git. I'm ready to migrate away from Atlassian. I'm just using SourceTree for now because I need something now and that's what I know. But I'll be happy to learn/use a new tool.

Similarly with Trello. It just keeps getting worse and worse since Atlassian bought them out. Part of the reason why I made my own To-do List app recently was because I keep fantasizing about making my ideal Trello replacement. At that point I'll be completely rid of all Atlassian products. :Thmbsup:

Not sure what kind of tooling/IDE you use for development, but I've been very content using VSCode with the Gitlens plugin. Admittedly, I'm 'only' using it with Github (and TFS/AzureDevOps-Git at work), but Gitlab sounds no more than natural to also being supported.

When you're using the Visual Studio IDE, there is the official Gitlab extension available in the marketplace, adding full Gitlab support to VS20xx.-Ath (April 13, 2021, 01:21 PM)
--- End quote ---

I used to be a big fan of Sublime Text several years ago, and I see VSCode as feeling pretty similar to it, but for some reason I haven't been able to "get into" using VSCode on anything.


As a direct alternative to SourceTree, Gitkraken is, AFAICS, free for open source Github and Gitlab repo's, so that could also be an option.
-Ath (April 13, 2021, 01:21 PM)
--- End quote ---

I've attempted to use Gitkraken in the past. It seems nice but I very rarely make my repositories open source or public, and I refuse to pay a subscription. If I could just pay $50-100 for it one time and then be able to use it forever, it might be worth it if it is good enough.

And then there's the 'Classic' TortoiseGIT extension for Windows Explorer, quite similar to TortoiseHg and TortoiseSVN.
-Ath (April 13, 2021, 01:21 PM)
--- End quote ---

Hmm... Yeah, I guess I'll have to give TortoiseGit a try, since I have years of experience with TortoiseHg.

I use sourcetree and Pageant so I know your pain about the format of the ppk. I'm not sure since you don't know your password, but you can try to regen with PuttyGen from your openssh key and put in the same password you think you used before to see if that helps you connect via SSH.

https://www.simplified.guide/putty/convert-ssh-key-to-ppk
-wraith808 (April 13, 2021, 02:42 PM)
--- End quote ---

Thanks for that! I've got the key converted to PPK format with PuTTYGen. The password worked. :Thmbsup:

Navigation

[0] Message Index

[#] Next page

Go to full version