TortoiseGit save user authentication / credentials

前端 未结 8 2226
轮回少年
轮回少年 2020-11-28 01:15

Is there a way to save GITHUB\'s user credentials with TortoiseGit?

It prompts me the below dialog every time whenever I do a push/pull.

I would

8条回答
  •  春和景丽
    2020-11-28 01:39

    None of the above answers worked for me using git version 1.8.3.msysgit.0 and TortoiseGit 1.8.4.0.

    In my particular situation, I have to connect to the remote git repo over HTTPS, using a full blown e-mail address as username. In this situation, wincred did not appear to work.

    Using the email address as a part of the repo URL also did not work, as the software seems to be confused by the double appearance of the '@' character in the URL.

    I did manage to overcome the problem using winstore. Here is what I did:

    • Download winstore from http://gitcredentialstore.codeplex.com/
    • Run git-credential-winstore.exe to install it.

    This will copy the git-credential-winstore.exe to a local directory and add two lines to your global .gitconfig. You can verify this by examining your global .gitconfig. This is easiest done via right mouse button on a folder, "TortoiseGit > Settings > Git > Edit global .gitconfig". The file should contain two lines like:

        [credential]
            helper = !'C:\\Users\\yourlogin\\AppData\\Roaming\\GitCredStore\\git-credential-winstore.exe'
    
    • No other TortoiseGit settings are needed under "Network" or "Credential". In particular: the "Credential helper" pull down menu under "Credential" will have gone blank as a result of these configuration lines, since TortoiseGit does not recognize the new helper. Do not set the pull down menu to another value or the global .gitconfig will be overwritten with an incorrect value! (*)

    You are now ready to go:

    • Try to pull from the remote repository. You will notice an authentication popup asking your username and password, the popup should be visually different from the default TortoiseGit popup. This is a good sign and means winstore works. Enter the correct authentication and the pull should succeed.
    • Try the same pull again, and your username and password should no longer be asked.

    Done! Enjoy your interactions with the remote repo while winstore takes care of the authentication.

    (*) Alternatively, if you don't like the blank selection in the TortoiseGit Credential settings helper pull down menu, you can use the "Advanced" option:

    • Go to "TortoiseGit > Settings > Credential"
    • Select Credential helper "Advanced"
    • Click on the "G" (for global) under Helpers
    • Enter the Helper path as below. Note: a regular Windows path notation (e.g. "C:\Users...") will not work here, you have to replicate the exact line that installing winstore created in the global .gitconf without the "helper =" bit.

      !'C:\\Users\\yourlogin\\AppData\\Roaming\\GitCredStore\\git-credential-winstore.exe'
      
    • Click the "Add New/Save" button

提交回复
热议问题