[git] TortoiseGit save user authentication / credentials

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 like to save my user credential information somewhere like how I did with TortoiseSVN.

enter image description here

This question is related to git github tortoisegit

The answer is


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:

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


[open git settings (TortoiseGit ? Settings ? Git)][1]

[In GIt: click to edit global .gitconfig][2]

config username and password


If you're going to downvote this answer

I wrote this a few months prior to the inclusion of git-credential in TortoiseGit. Given the number of large security holes found in the last few years and how much I've learned about network security, I would HIGHLY recommend you use a unique (minimum 2048-bit RSA) SSH key for every server you connect to.

The below syntax is still available, though there are far better tools available today like git-credential that the accepted answer tells you how to use. Do that instead.


Try changing the remote URL to https://[email protected]/username/repo.git where username is your github username and repo is the name of your repository.

If you also want to store your password (not recommended), the URL would look like this: https://username:[email protected]/username/repo.git.

There's also another way to store the password from this github help article: https://help.github.com/articles/set-up-git#password-caching


Goto the project repo, right click -> 'Git Bash Here'

In the git bash windows type

cd ~
pwd

i get something like this

/c/Users/<windows_username>

Now copy your public and private keys to this path

C:\Users\<windows_username>\.ssh

i got the below files there

id_rsa
id_rsa.pub
known_hosts

here

Now when ever it needs to use the credentials it uses these files and prompt for password if needed.


I upgraded to my Git for Windows to latest (2.30.0) 64-bit and it works fine now. get the latest from the url https://git-scm.com/download/win and run the commands below to verify. $ git --version $ git version 2.30.0.windows.1


For msysgit 1.8.0, download git-credential-wincred.exe from https://github.com/downloads/msysgit/git/git-credential-wincred.zip and put into C:\Program Files\Git\libexec\git-core

For msysgit 1.8.1 and later, the exe is built-in.

in git config, add the following settings.

[credential] helper = wincred


If you are a windows 10 + TortoiseGit 2.7 user:

  1. for the first time login, simply follow the prompts to enter your credentials and save password.
  2. If you ever need to update your credentials, don't waste your time at the TortoiseGit settings. Instead, windows search>Credential Manager> Windows Credentials > find your git entry > Edit.

Saving username and password with TortoiseGit

Saving your login details in TortoiseGit is pretty easy. Saves having to type in your username and password every time you do a pull or push.

  1. Create a file called _netrc with the following contents:

    machine github.com
    login yourlogin
    password yourpassword

  2. Copy the file to C:\Users\ (or another location; this just happens to be where I’ve put it)

  3. Go to command prompt, type setx home C:\Users\

Note: if you’re using something earlier than Windows 7, the setx command may not work for you. Use set instead and add the home environment variable to Windows using via the Advanced Settings under My Computer.

CREDIT TO: http://www.munsplace.com/blog/2012/07/27/saving-username-and-password-with-tortoisegit/


Examples related to git

Does the target directory for a git clone have to match the repo name? Git fatal: protocol 'https' is not supported Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) git clone: Authentication failed for <URL> destination path already exists and is not an empty directory SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 GitLab remote: HTTP Basic: Access denied and fatal Authentication How can I switch to another branch in git? VS 2017 Git Local Commit DB.lock error on every commit How to remove an unpushed outgoing commit in Visual Studio?

Examples related to github

Does the target directory for a git clone have to match the repo name? Issue in installing php7.2-mcrypt How can I switch to another branch in git? How to draw checkbox or tick mark in GitHub Markdown table? How to add a new project to Github using VS Code git clone error: RPC failed; curl 56 OpenSSL SSL_read: SSL_ERROR_SYSCALL, errno 10054 How to add empty spaces into MD markdown readme on GitHub? key_load_public: invalid format git - remote add origin vs remote set-url origin Cloning specific branch

Examples related to tortoisegit

Your configuration specifies to merge with the <branch name> from the remote, but no such ref was fetched.? Git error: "Please make sure you have the correct access rights and the repository exists" TortoiseGit-git did not exit cleanly (exit code 1) TortoiseGit save user authentication / credentials How to resolve "git did not exit cleanly (exit code 128)" error on TortoiseGit? Git with SSH on Windows