Finding Where Git Credentials Stored

8.2k views Asked by At

I have encountered a weird situation where I am left wondering how I can push to a repo.

I have 2 repos, one is public, and the other is under company's Github Enterprise. Well I just cloned an HTTPs repo link from enterprise one and that went ok, which normally does not require any credentials.

However, when I realized I can also push, I started wondering where the credentials were stored. I checked .git/config

remote "origin"]
    url = https://mygithub.blablacompany.com/blablaUsername/blabla.git
    fetch = +refs/heads/*:refs/remotes/origin/*

Then I checked git config --list , lists bunch of other repo usernames and also:

remote.origin.url=https://mygithub.blablacompany.com/blablaUsername/blabla.git
remote.origin.fetch=+refs/heads/*:refs
branch.master.remote=origin
branch.master.merge=refs/heads/master

Then I checked whether ./git-credentials exist in home folder. Nope it does not. I searched for it all over the local drive, does not exist.

Then I checked whether git credentials manager for windows exist:

> git credential-manager version
> Git Credential Manager for Windows version 1.6.1

Ok so I assume it stored in Windows Credentials. But when I go to User credentials I see no records, nothing about git.

I tried running git config credential.helper which returns:

!github --credentials

So I assume everything after the exclamation mark is a shell command. Okay, so I tried checking the global config under /Users/Me:

There is one, but it is entirely for another, non-enterprise repo.

So how am I even able to push to this repo? How can I trace where the password/ssh key is stored?

1

There are 1 answers

0
Shaqil Ismail On

You can view all of your Git settings, the files, and locations of the files with,

git config --list --show-origin