Sublime Forum

Sublime Merge / How to save Git Credentials / Win 11

#1

I have seen this question asked before a few times but I fail to find the solution for the issue.

How to tell Sublime Merge to save Git Credentials in Windows?

Its such a basic feature that it is kind of strange that I have to ask for this. I also did not have this issue when Merge came out and I used it for the first time.

I seem to be doing something wrong, but its not obvious to me what exactly.

0 Likes

#2

Unfortunately there might be multiple reasons why SM is not saving the credentials.

Have a look at the dedicated Issue on SM bug-reports repository on this topic:

You’ll find various explanations of the possible causes of the problem and its solutions, which can vary from one OS to another. On Windows, one of the most frequent causes is due to the default Git installation using a different credential manager than the one used by SM, but there could be other causes as well.

The easies test you can do is to tweak SM settings to use native Git instead of the custom Git engine.

Reading through the (rather long) Issue linked above will surely provide you with better insight of where things might be going wrong, and how to check for the root cause of the problem.

0 Likes

#3

Thank you for your reply!

However, I decided to just use another software as this is just … basic. It should just work. I feel this is a massive problem in the software that should not require the user to understand the internals of the program and trying to fix something that should not be broken in the first place.

It didnt work after a clean re-install of Windows btw. So its apparently broken out-of-the-box and has not been ~a year ago when I started using Sublime Merge.

1 Like

#4

Sublime Merge just runs git executable to perform any kind of mutation or upstream action.

I use Sublime Merge together with Git for Windows. The latter one ships with Git Credential Manager to store and provide access tokens.

Setup once, working like a charm without a single password entry dialog - neither in command line nor any other GUI.

Setting up ssh keys using Windows’ ssh client is somewhat more tedious, as the agent service is not started automatically by default, but that’s a common issue with lots of google responses as well.

It’s IMHO just a question of mastering git.

0 Likes

#5

That’s only if you disable the default option to use SM’s native Git engine instead, and using one or the other does not lead to identical results. E.g. I had to disable the native Git engine because it doesn’t work with Git hooks — which I’ve setup using Git for Windows.

The hooks problem shows that sometimes it’s also a problem with the SM custom Git engine. But it’s true that many common problems can be solved if one masters Git, but then it’s also true that many SM users have an expectation that the tool will simplify using Git to a certain extend, via a powerful GUI and commands that abstract away the complexities of the command line.

I believe that one of the problems affecting credentials under Windows is that Win 10 has changed its native credential manager in recent years, and this has in many cases affected the previous Git settings. I’m not sure whether Git for Windows has changed its credential manager, or its default settings (at least at installation time) after the switch of Win 10’s native credential manager. But I do remember that at the time of this change I had to revise my Git settings, since they were also affecting other Git tools (GUIs, etc.).

I remember that at some point GitHub introduced some changes into its users log-in mechanisms, and that suddenly SM wouldn’t carry any operations that required credentials, due to a pop-up window that was added to the process. While this GitHub specific problem was promptly solved, I’m still experiencing similar credential problems with my own Git server running in my NAS-

@jcvr is right when he (she?) states that this is such a fundamental Git operation that it should simply work out of the box, seamlessly. Even though SM can’t manage third party tools settings (e.g. Git for Windows settings and installation) and possibly handle all problems related to global or local Git settings, it could at least compensate in terms of helpful documentation for troubleshooting common problems (and less common ones too), so that users can at least find a solution.

It would be nice, for example, if the IDE could look into the Git errors encountered and suggest a link to the documentation or some third party article which can help solving the issue, or at least gain a better understanding of it.

0 Likes

#6

Just for the record. SM/ST’s “native git engine” is to read local git repository, only!

All modifying operations such as stage/commit/push/pull/ … are all performed by official git binaries.

SM bundles MinGit-x.xx.x.x-64-bit.zip (see: https://github.com/git-for-windows/git/releases) to be operational without external dependencies. It’s probably the nature of that minimal setup not to support all kinds of high-end features as required modules are just not part of it.

Agree in general, but probably possible setups and requirements are too widly spreat to guarantee under all circumstances.

Using official Github, private Github server appliance, Bitbucket without any issue for years. It’s working that great, that I even forgot how I set all things up. :blush:

I can remember a change in githubs auth philosophy (two-factor-auth), too. It was the point, when I set-up SSH as primary communication protocol.

Just followed official docs about creating a SSH key and setting up putty paagent or Win10’s ssh client. As it ends up in setting GIT_SSH=C:\WINDOWS\System32\OpenSSH\ssh.exe environment variable, it works with SM out of the box as well.

After upgrading my personal access token, last week, new authentication process worked “nearly seemlessly”. Git Credential Manager just popped up the challanges dialog, I followed the instructions - SM displayed a askpass dialog once (false positive), but then everything worked normally as before, even for HTTPS conneced repos.

TL;TR: Setup SSH/HTTPS auth for cli git (as needed anyway) and its working for SM and all other tool, too. I also have Git Extensions, but rarely have used it in the last months/years.

0 Likes

#7

Out of curiosity …

  1. Set up a fresh Win11 VM
  2. Installed SM 2076
  3. Cloned one of my repos from Github
  4. Added a dump commit
  5. Pushed back to Github

The following screencast shows the authentication process using bundled git.

I find it very straight forward and seemless.

0 Likes

#8

Just because it bugs me really that this is not working and I dont see why I show what exactly SM shows me and what I do.

I Create a clone of the repo:

I get asked for and I copy the GIT credentials I created into the form:
image

Note that there is no “Save credentials” option.

It creates the local copy of the repo just fine.

However each Pull request even in the same session leads to the user/pass question again. Credentials are not cached/saved. I am not sure but I think that they have been stored in the Windows Credential Manager in the past.

I do not see what a simple user like me can do at this point.
I am certainly not mastering GIT and probably will never will. I am a really simple end-user of our GIT using it rarely to commit smaller changes in scripts. I am not even a programmer.

So forgive my ignorance, but I am really not sure what I could do differently as an end-user at this point.
Especially since the same approach worked just fine about a year ago.

I do not have installed any other GIT related tools - at least not that I am aware of.

0 Likes

#9

It appears an additional git configuration is required for Git Credential Manager Core to be able to handle Azure repositories.

It seems missing in SM’s default configuration for bundled MinGit - maybe because it is needed for each remote individually.

What might be required is …

credential.https://dev.azure.com.usehttppath=true

The easiest way for you to add it is…

  1. Create or open %USERPROFILE%\.gitconfig with editor
  2. Paste the following lines
[credential "https://dev.azure.com"]
	useHttpPath = true

Disclaimer: I never used dev.azure.com The config is a result of running git-credential-manager-core configure, so I assume it may be needed.


TL;TR:

Sublime Merge bundles MinGit, which comes with Git Credential Manager Core to securily handle credential storage.

It doesn’t store credentials internally for good security reasons, but relies on a defacto standard tool/method for git authentication managemt.

The password dialog is the last fallback stage to ask for credentials.

Seeing it means GCMC failed authenticating, maybe because of …

  1. being blocked from running (virus scanner)
  2. being blocked from communicating with server (by firewall)
  3. not supporting the remote’s authentication methods

GCMC supports Azure according to Use Git Credential Manager to authenticate to Azure Repos.

2 Likes

#10

This did the trick. Even better than before: No password needed, single-sign-on is working.

Its still a mystery for me, but I am happy with this result.

Thank you to everyone for the help.

0 Likes