Where is my remote git repository password stored on the local machine?
Asked Answered
D

4

49

I have a git repository set up on bitbucket

$ git remote -v
origin  https://[email protected]/myusername/my_repository_name.git (fetch)
origin  https://[email protected]/myusername/my_repository_name.git (push)

I pull and push to the repository from my office workstation and home PC. When I push or pull from my office workstation, it prompts me for the password. However when I push or pull from my home PC it doesn't prompt for a password.

I don't specifically remember what I did on my home PC to remember the password.

running $ git config credential.helper returns manager

$ git config credential.helper
manager

Contents .gitconfig file in my user folder at root level

[user]
name = myusername
email = [email protected]

Where is the password stored on the local disk?

What is the command to check the status of current credentials?

How do I similarly remember the password on my office workstation?

Note: I am using Windows 7

Donadonadee answered 3/3, 2017 at 17:20 Comment(3)
Have you checked this confluence.atlassian.com/bitbucketserver/…Transfiguration
@Transfiguration I haven't used any of the methods given thereDonadonadee
Are you using the Git Credential Manager at both home and work? If you are at work, it should remember. (link has information about where passwords are stored).Missis
D
69

if $ git config credential.helper returns manager, the password is stored in the windows credential manager, if it returns store, password is stored in a .git-credentials file in the user folder.

Donadonadee answered 4/3, 2017 at 11:42 Comment(4)
It can be osxkeychain in that case then it is stored in keychain (Mac)Ain
What if it returns helper-selector?Beach
Is this setup by windows automatically? I don't remember setting any config other than just doing git clone and authenticating. Now I am trying to access a repo from a different account and trying to figure out how to prevent git from using the previous user, since it gives error that it can't find the remote repo (as its looking under my previously used account).Angelynanger
@Angelynanger you can configure the user locally in each git repo inside the .git folderDonadonadee
R
23

With the default configuration of git on windows, this is stored in Windows under: control panel => User => Credential manager.

See a more details answer here

Receiver answered 3/3, 2017 at 18:0 Comment(0)
C
13
sudo cat ~/.git-credentials

If you have saved credentials locally, will yield
https://<USERNAME>:<PASSWORD_OR_TOKEN_IN_USE>@github.com

Carryingon answered 22/9, 2020 at 19:7 Comment(0)
N
3

In my case git config credential.helper was empty (local and global both). Turns out the credentials were stored in KWallet. Those are found in KWalletManager under ksshaskpass (even though I am using HTTPS auth for this particular repo) under "Passwords".

Necklace answered 28/1, 2022 at 15:41 Comment(1)
I was also looking in KWallet, but the ksshaskpass name seemed unrelated so I missed it. Thanks for pointing this!Tabu

© 2022 - 2024 — McMap. All rights reserved.