Git credential manager for windows как убрать

I notice that in the latest version of Git, the default is now to popup a "Git Credential Manager for Windows" dialog instead of prompting me for me password at the Bash prompt every time. I reall...

It didn’t work for me:

C:Program FilesGitmingw64libexecgit-core
git-credential-manager.exe uninstall

Looking for Git installation(s)...
  C:Program FilesGit

Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]

Removing from 'C:Program FilesGit'.
  removal failed. U_U

Press any key to continue...

But with the --force flag it worked:

C:Program FilesGitmingw64libexecgit-core
git credential-manager uninstall --force
08:21:42.537616 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
e
08:21:42.538616 git.c:576               trace: exec: git-credential-manager uninstall --force
08:21:42.538616 run-command.c:640       trace: run_command: git-credential-manager uninstall --force

Looking for Git installation(s)...
  C:Program FilesGit

Updated your /etc/gitconfig [git config --system]
Updated your ~/.gitconfig [git config --global]


Success! Git Credential Manager for Windows was removed! ^_^

Press any key to continue...

I could see that trace after I run:

set git_trace=1

Also I added the Git username:

git config --global credential.username myGitUsername

Then:

C:Program FilesGitmingw64libexecgit-core
git config --global credential.helper manager

In the end I put in this command:

git config --global credential.modalPrompt false

I check if the SSH agent is running

  • open a Bash window to run this command
eval "$(ssh-agent -s)"

Then in the computer users/yourName folder where .ssh is, add a connection (still in Bash):

ssh-add .ssh/id_rsa

or

ssh-add ~/.ssh/id_rsa (if you are not in that folder)

I checked all the settings that I add above:

C:Program FilesGitmingw64libexecgit-core
git config --list
09:41:28.915183 exec_cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-cor
e
09:41:28.917182 git.c:344               trace: built-in: git config --list
09:41:28.918181 run-command.c:640       trace: run_command: unset GIT_PAGER_IN_USE; LESS=FRX LV=-c less
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
rebase.autosquash=true
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
http.sslbackend=openssl
diff.astextplain.textconv=astextplain
filter.lfs.clean=git-lfs clean -- %f
filter.lfs.smudge=git-lfs smudge -- %f
filter.lfs.process=git-lfs filter-process
filter.lfs.required=true
credential.helper=manager
credential.modalprompt=false
credential.username=myGitUsername

And when I did git push again I had to add username and password only for the first time.

git push
Please enter your GitHub credentials for https://myGithubUsername@github.com/
username: myGithubUsername
password: *************
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 316 bytes | 316.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.

Since then using git push, I don’t have the message to enter my Git credentials any more.

D:projectsreact-reduxmyProject (master -> origin) (budget@1.0.0)
λ git push
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 314 bytes | 314.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/myGitUsername/myProject.git
   8d38b18..f442d74  master -> master

After these settings I received an email too with the message:

A personal access token (git: https://myGitHubUsername@github.com/
on LAP0110 at 25-Jun-2018 09:22) with gist and repo scopes was recently added
to your account. Visit https://github.com/settings/tokens for more information.

If this problem comes on a Windows machine, do the following.

  • Go to Credential Manager

    • in German, it is called: Anmeldeinformationsverwaltung
    • in French, it is called: Gestionnaire d’identification
    • in Polish, it is called: Menedżer poświadczeń
    • in Portuguese, it is called: Gerenciador de Credenciais
    • in Russian, it is called: Диспетчер учётных данных
    • in Spanish, it is called: Administrador de credenciales
    • in Norwegian, it is called: Legitimasjonsbehandling
    • in Czech, it is called: Správce pověření
    • in Dutch, it is called: Referentiebeheer

    Go to Credential Manager

  • Go to Windows Credentials

  • Delete the entries under Generic Credentials

    Go to Windows Credentials and Delete the entries under Generic Credentials

  • Try connecting again. This time, it should prompt you for the correct username and password.

brz's user avatar

brz

1,78120 silver badges21 bronze badges

answered Sep 21, 2016 at 6:24

Venkataramana Madugula's user avatar

16

The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache—daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.

You could also disable use of the Git credential cache using git config --global --unset credential.helper. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.helper if this has been set in the system configuration file (for example, Git for Windows 2).

On Windows you might be better off using the manager helper (git config --global credential.helper manager). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.

Extract from the Windows 10 support page detailing the Windows credential manager:

To open Credential Manager, type «credential manager» in the search box on the taskbar and select Credential Manager Control panel.

And then select Windows Credentials to edit (=remove or modify) the stored git credentials for a given URL.

Community's user avatar

answered Mar 13, 2013 at 10:38

patthoyts's user avatar

14

Retype:

$ git config credential.helper store

And then you will be prompted to enter your credentials again.

WARNING

Using this helper will store your passwords unencrypted on disk

Source: https://git-scm.com/docs/git-credential-store

answered Nov 18, 2014 at 18:55

aaafly's user avatar

aaaflyaaafly

2,8181 gold badge14 silver badges11 bronze badges

5

I faced the same issue as the OP. It was taking my old Git credentials stored somewhere on the system and I wanted to use Git with my new credentials, so I ran the command

$ git config --system --list

It showed

credential.helper=manager

Whenever I performed git push it was taking my old username which I set long back, and I wanted to use new a GitHub account to push changes. I later found that my old GitHub account credentials was stored under
Control PanelUser AccountsCredential ManagerManage Windows Credentials.

Manage Windows Credentials

I just removed these credentials and when I performed git push it asked me for my GitHub credentials, and it worked like a charm.

Peter Mortensen's user avatar

answered Sep 20, 2016 at 11:09

Mourya's user avatar

MouryaMourya

2,2803 gold badges18 silver badges24 bronze badges

7

Try using the below command.

git credential-manager

Here you can get various options to manage your credentials (check the below screen).

Enter image description here

Or you can even directly try this command:

git credential-manager uninstall

This will start prompting for passwords again on each server interaction request.

Peter Mortensen's user avatar

answered Aug 11, 2016 at 5:57

Himanshu Aggarwal's user avatar

8

I found something that worked for me. When I wrote my comment to the OP I had failed to check the system config file:

git config --system -l

shows a

credential.helper=!github --credentials

line. I unset it with

git config --system --unset credential.helper

and now the credentials are forgotten.

Jaap's user avatar

Jaap

60913 silver badges18 bronze badges

answered Nov 18, 2015 at 11:21

damix911's user avatar

damix911damix911

4,1051 gold badge28 silver badges43 bronze badges

3

git config --list

will show credential.helper = manager (this is on a windows machine)

To disable this cached username/password for your current local git folder, simply enter

git config credential.helper ""

This way, git will prompt for password every time, ignoring what’s saved inside «manager».

answered Sep 25, 2017 at 14:51

Zhe Hu's user avatar

Zhe HuZhe Hu

3,6474 gold badges32 silver badges42 bronze badges

6

This error appears when you are using multiple Git accounts on the same machine.

If you are using macOS then you can remove the saved credentials of github.com.

Please follow below steps to remove the github.com credentials.

  1. Open Keychain Access
  2. Find github
  3. Select the github.com and Right click on it
  4. Delete «github.com»
  5. Try again to Push or Pull to git and it will ask for the credentials.
  6. Enter valid credentials for repository account.
  7. Done

    enter image description here

brian d foy's user avatar

brian d foy

127k31 gold badges204 silver badges581 bronze badges

answered Dec 3, 2018 at 11:11

Pratik Patel's user avatar

Pratik PatelPratik Patel

2,0993 gold badges22 silver badges29 bronze badges

2

In my case, Git is using Windows to store credentials.

All you have to do is remove the stored credentials stored in your Windows account:

Windows credentials menu

Peter Mortensen's user avatar

answered Mar 2, 2017 at 14:20

SoliQuiD's user avatar

SoliQuiDSoliQuiD

1,9931 gold badge23 silver badges29 bronze badges

2

You have to update it in your Credential Manager.

Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won’t throw any more error messages.

Stephen Rauch's user avatar

Stephen Rauch

46.7k31 gold badges109 silver badges131 bronze badges

answered Jun 18, 2018 at 23:45

ChiragBhalgami's user avatar

2

In Windows 2003 Server with «wincred»*, none of the other answers helped me. I had to use cmdkey.

  • cmdkey /list lists all stored credentials.
  • cmdkey /delete:Target deletes the credential with «Target» name.

cmdkey /list; cmdkey /delete:Target

(* By «wincred» I mean git config --global credential.helper wincred)

answered Dec 12, 2016 at 23:55

ericbn's user avatar

ericbnericbn

9,6923 gold badges45 silver badges53 bronze badges

1

Using latest version of git for Windows on Windows 10 Professional and I had a similar issue whereby I have two different GitHub accounts and also a Bitbucket account so things got a bit confusing for VS2017, git extensions and git bash.

I first checked how git was handling my credentials with this command (run git bash with elevated commands or you get errors):

git config --list

I found the entry Credential Manager so I clicked on the START button > typed Credential Manager to and left-clicked on the credential manager yellow safe icon which launched the app. I then clicked on the Windows Credentials tabs and found the entry for my current git account which happened to be Bit-bucket so I deleted this account.

But this didn’t do the trick so the next step was to unset the credentials and I did this from the repository directory on my laptop that contains the GitHub project I am trying to push to the remote. I typed the following command:

git config --system --unset credential.helper

Then I did a git push and I was prompted for a GitHub username which I entered (the correct one I needed) and then the associated password and everything got pushed correctly.

I am not sure how much of an issue this is going forward most people probably work off the one repository but I have to work across several and using different providers so may encounter this issue again.

Community's user avatar

answered Sep 16, 2018 at 15:51

Trevor's user avatar

TrevorTrevor

1,5311 gold badge19 silver badges27 bronze badges

1

Got same error when doing a ‘git pull’ and this is how I fixed it.

  1. Change repo to HTTPS
  2. Run command git config --system --unset credential.helper
  3. Run command git config --system --add credential.helper manager
  4. Test command git pull
  5. Enter credentials in the login window that pops up.
  6. Git pull completed successfully.

Daniel Fisher  lennybacon's user avatar

answered Oct 1, 2018 at 3:25

Amer Bashoeb's user avatar

2

If you want git to forget old saved credentials and re-enter username and password, you can do that using below command:

git credential-cache exit

After running above command, if you try to push anything it will provide option to enter username and password.

answered Dec 13, 2019 at 8:25

amitshree's user avatar

amitshreeamitshree

1,9342 gold badges22 silver badges40 bronze badges

5

In case Git Credential Manager for Windows is used (which current versions usually do):

git credential-manager clear

This was added mid-2016. To check if credential manager is used:

git config --global credential.helper
→ manager

answered Jan 23, 2018 at 15:53

Simon A. Eugster's user avatar

Simon A. EugsterSimon A. Eugster

4,0544 gold badges35 silver badges31 bronze badges

  1. Go to C:Users<current-user>
  2. check for .git-credentials file
  3. Delete content or modify as per your requirement
  4. Restart your terminal

answered Jul 16, 2018 at 21:00

Dinesh Patil's user avatar

Dinesh PatilDinesh Patil

1,03210 silver badges13 bronze badges

1

If your credentials are stored in the credential helper (generally the case), the portable way to remove a password persisted for a specific host is to call git credential reject:

  • in one line:

    $ echo "url=https://appharbor.com" | git credential reject
    
  • or interactively:

    $ git credential reject
    protocol=https
    host=gitlab.com
    username=me@example.com
    ↵
    
    • ↵ is the Enter symbol, just hit Enter key twice at the end of input, don’t copy/paste it
    • The username doesn’t seem recognized by wincred, so avoid to filter by username on Windows

After that, to enter your new password, type git fetch.

https://git-scm.com/docs/git-credential

answered Jun 27, 2020 at 10:39

Marsu's user avatar

MarsuMarsu

7366 silver badges9 bronze badges

0

Need to login with respective github username and password

To Clear the username and password in windows

Control PanelUser AccountsCredential Manager

Edit the windows Credential

Remove the existing user and now go to command prompt write the push command it shows a github pop-up to enter the username/email and password .

Now we able to push the code after switching the user.

answered Feb 12, 2018 at 13:28

Amit K's user avatar

Amit KAmit K

1711 silver badge4 bronze badges

0

In my case, I couldn’t find the credentials saved in the Windows Credential Manager (Windows 7).

I was able to reset my credentials by executing

git config --global credential.helper wincred

It was honestly a hail Mary to see if it would wipe out my credentials and it actually worked.

answered Feb 22, 2017 at 17:53

Jeff LaFay's user avatar

Jeff LaFayJeff LaFay

12.7k13 gold badges72 silver badges100 bronze badges

1

Remove this line from your .gitconfig file located in the Windows’ currently logged-in user folder:

[credential]
helper = !"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe"

This worked for me and now when I push to remote it asks for my password again.

Peter Mortensen's user avatar

answered Aug 22, 2013 at 9:23

Liviu Mandras's user avatar

Liviu MandrasLiviu Mandras

6,4941 gold badge41 silver badges63 bronze badges

0

On Windows, at least, git remote show [remote-name] will work, e.g.

git remote show origin

answered May 2, 2019 at 19:57

Jason S's user avatar

Jason SJason S

182k161 gold badges593 silver badges953 bronze badges

4

This approach worked for me and should be agnostic of OS. It’s a little heavy-handed, but was quick and allowed me to reenter credentials.

Simply find the remote alias for which you wish to reenter credentials.

$ git remote -v 
origin  https://bitbucket.org/org/~username/your-project.git (fetch)
origin  https://bitbucket.org/org/~username/your-project.git (push)

Copy the project path (https://bitbucket.org/org/~username/your-project.git)

Then remove the remote

$ git remote remove origin

Then add it back

$ git remote add origin https://bitbucket.org/org/~username/your-project.git

answered Jul 16, 2020 at 16:08

Josh's user avatar

JoshJosh

6547 silver badges9 bronze badges

2

You can remove the line credential.helper=!github --credentials from the following file C:Program FilesGitmingw64etcgitconfig in order to remove the credentials for git

Liam's user avatar

Liam

26.7k27 gold badges120 silver badges184 bronze badges

answered May 25, 2016 at 4:19

Yoan Pumar's user avatar

Yoan PumarYoan Pumar

941 silver badge3 bronze badges

0

For macOS users :

This error appears when you are using multiple Git accounts on the same machine.

Please follow below steps to remove the github.com credentials.

  1. Go to Finder
  2. Go to Applications
  3. Go to Utilities Folder
  4. Open Keychain Access
  5. Select the github.com and Right click on it

Delete «github.com»

Try again to Push or Pull to git and it will ask for the credentials.
Enter valid credentials for repository account.
Done, now upvote the answer.

answered Dec 4, 2018 at 4:18

Suraj Chandgude's user avatar

No answer given worked for me. But here is what worked for me in the end:

rm -rf ~/.git-credentials

That will remove any credentials! When you use a new git command, you will be asked for a password!

answered Jan 7, 2022 at 8:34

Alex's user avatar

AlexAlex

41.1k81 gold badges234 silver badges447 bronze badges

1

Building from @patthoyts’s high-voted answer:

His answer uses but doesn’t explain local vs. global vs. system configs. The official git documentation for them is here and worth reading.

For example, I’m on Linux, and don’t use a system config, so I never use a --system flag, but do commonly need to differentiate between --local and --global configs.

My use case is I’ve got two Github crendentials; one for work, and one for play.

Here’s how I would handle the problem:

$ cd work
# do and commit work
$ git push origin develop
# Possibly prompted for credentials if I haven't configured my remotes to automate that. 
# We're assuming that now I've stored my "work" credentials with git's credential helper.

$ cd ~/play 
# do and commit play
$ git push origin develop                                                                   
remote: Permission to whilei/specs.git denied to whilei.                
fatal: unable to access 'https://github.com/workname/specs.git/': The requested URL returned error: 403

# So here's where it goes down:
$ git config --list | grep cred
credential.helper=store # One of these is for _local_
credential.helper=store # And one is for _global_

$ git config --global --unset credential.helper
$ git config --list | grep cred
credential.helper=store # My _local_ config still specifies 'store'
$ git config --unset credential.helper
$ git push origin develop
Username for 'https://github.com': whilei
Password for 'https://whilei@github.com':
Counting objects: 3, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.10 KiB | 1.10 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/whilei/specs.git
   b2ca528..f64f065  master -> master

# Now let's turn credential-helping back on:
$ git config --global credential.helper "store"
$ git config credential.helper "store"
$ git config --list | grep cred
credential.helper=store # Put it back the way it was.
credential.helper=store

It’s also worth noting that there are ways to avoid this problem altogether, for example, you can use ~/.ssh/config‘s with associated SSH keys for Github (one for work, one for play) and correspondingly custom-named remote hosts to solve authentication contextualizing too.

Bazer Con's user avatar

answered Dec 21, 2018 at 18:42

irbanana's user avatar

irbananairbanana

81012 silver badges19 bronze badges

What finally fixed this for me was to use GitHub desktop, go to repository settings, and remove user:pass@ from the repository url. Then, I attempted a push from the command line and was prompted for login credentials. After I put those in everything went back to normal. Both Visual Studio and command line are working, and of course, GitHub desktop.

GitHub Desktop->Repository->Repository Settings->Remote tab

Change Primary Remote Repository (origin) from:

https://pork@muffins@github.com/MyProject/MyProject.git

To:

https://github.com/MyProject/MyProject.git

Click «Save»

Credentials will be cleared.

answered Aug 4, 2018 at 8:40

Nick Pirocanac's user avatar

2

Update Actually useHttpPath is a git configuration, which should work for all GCMs. Corrected.

Summary of The Original Question

  • working with git on Windows
  • working on multiple repositories on GitHub
  • wrong credentials used for another GitHub repository

Although the title says «Remove credentials», the description leads me to the assumption that you may have multiple accounts on GitHub, e.g. for job-related vs. private projects. (At least that issue made me find this topic.)
If so read on, otherwise, ignore the answer, but it may come in handy at some time.

Reason

Git Credential Managers (short GCM) like Microsoft’s GCM for Windows store credentials per host by default.
This can be verified by checking the Windows Credential Manager (see other answers on how to access it on English, French, and German Windows versions).
So working with multiple accounts on the same host (here github.com) is not possible by default.

In October 2020 GCM for Windows got deprecated and superseded by GCM Core. The information here still applies to the new GCM and it should even use the credentials stored by GCM for Windows.

Solution

Configure git to include the full path to the repository as additional information for each credential entry. Also documented on GCM for Windows.
I personally prefer to include the HTTP(S) [repository] path to be able to use a separate account for each and every repository.

For all possible hosts:

git config --global credential.useHttpPath true

For github.com only:

git config --global credential.github.com.useHttpPath true

Have a look at the GCM and git docs and maybe you want to specify something different.

Vlad L.'s user avatar

Vlad L.

1541 silver badge9 bronze badges

answered Jun 20, 2020 at 22:59

Maddes's user avatar

MaddesMaddes

1811 silver badge4 bronze badges

In our case, clearing the password in the user’s .git-credentials file worked.

c:users[username].git-credentials

Bazer Con's user avatar

answered May 4, 2016 at 18:28

Fares's user avatar

FaresFares

6595 silver badges11 bronze badges

2

For Windows 10, go to below path,

Control PanelUser AccountsCredential Manager

There will be 2 tabs at this location,

  1. Web credentials and 2. Windows credentials.

Click on Windows credentials tab and here you can see your stored github credentials,
under «Generic credentials» heading.

You can remove those from here and try and re-clone — it will ask for username/password now as we have just removed the stored credential from the Windows 10 systems

answered Mar 3, 2020 at 8:28

AADProgramming's user avatar

AADProgrammingAADProgramming

5,88211 gold badges37 silver badges58 bronze badges

If this problem comes on a Windows machine, do the following.

  • Go to Credential Manager

    • in German, it is called: Anmeldeinformationsverwaltung
    • in French, it is called: Gestionnaire d’identification
    • in Polish, it is called: Menedżer poświadczeń
    • in Portuguese, it is called: Gerenciador de Credenciais
    • in Russian, it is called: Диспетчер учётных данных
    • in Spanish, it is called: Administrador de credenciales
    • in Norwegian, it is called: Legitimasjonsbehandling
    • in Czech, it is called: Správce pověření
    • in Dutch, it is called: Referentiebeheer

    Go to Credential Manager

  • Go to Windows Credentials

  • Delete the entries under Generic Credentials

    Go to Windows Credentials and Delete the entries under Generic Credentials

  • Try connecting again. This time, it should prompt you for the correct username and password.

brz's user avatar

brz

1,78120 silver badges21 bronze badges

answered Sep 21, 2016 at 6:24

Venkataramana Madugula's user avatar

16

The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache—daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.

You could also disable use of the Git credential cache using git config --global --unset credential.helper. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.helper if this has been set in the system configuration file (for example, Git for Windows 2).

On Windows you might be better off using the manager helper (git config --global credential.helper manager). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.

Extract from the Windows 10 support page detailing the Windows credential manager:

To open Credential Manager, type «credential manager» in the search box on the taskbar and select Credential Manager Control panel.

And then select Windows Credentials to edit (=remove or modify) the stored git credentials for a given URL.

Community's user avatar

answered Mar 13, 2013 at 10:38

patthoyts's user avatar

14

Retype:

$ git config credential.helper store

And then you will be prompted to enter your credentials again.

WARNING

Using this helper will store your passwords unencrypted on disk

Source: https://git-scm.com/docs/git-credential-store

answered Nov 18, 2014 at 18:55

aaafly's user avatar

aaaflyaaafly

2,8181 gold badge14 silver badges11 bronze badges

5

I faced the same issue as the OP. It was taking my old Git credentials stored somewhere on the system and I wanted to use Git with my new credentials, so I ran the command

$ git config --system --list

It showed

credential.helper=manager

Whenever I performed git push it was taking my old username which I set long back, and I wanted to use new a GitHub account to push changes. I later found that my old GitHub account credentials was stored under
Control PanelUser AccountsCredential ManagerManage Windows Credentials.

Manage Windows Credentials

I just removed these credentials and when I performed git push it asked me for my GitHub credentials, and it worked like a charm.

Peter Mortensen's user avatar

answered Sep 20, 2016 at 11:09

Mourya's user avatar

MouryaMourya

2,2803 gold badges18 silver badges24 bronze badges

7

Try using the below command.

git credential-manager

Here you can get various options to manage your credentials (check the below screen).

Enter image description here

Or you can even directly try this command:

git credential-manager uninstall

This will start prompting for passwords again on each server interaction request.

Peter Mortensen's user avatar

answered Aug 11, 2016 at 5:57

Himanshu Aggarwal's user avatar

8

I found something that worked for me. When I wrote my comment to the OP I had failed to check the system config file:

git config --system -l

shows a

credential.helper=!github --credentials

line. I unset it with

git config --system --unset credential.helper

and now the credentials are forgotten.

Jaap's user avatar

Jaap

60913 silver badges18 bronze badges

answered Nov 18, 2015 at 11:21

damix911's user avatar

damix911damix911

4,1051 gold badge28 silver badges43 bronze badges

3

git config --list

will show credential.helper = manager (this is on a windows machine)

To disable this cached username/password for your current local git folder, simply enter

git config credential.helper ""

This way, git will prompt for password every time, ignoring what’s saved inside «manager».

answered Sep 25, 2017 at 14:51

Zhe Hu's user avatar

Zhe HuZhe Hu

3,6474 gold badges32 silver badges42 bronze badges

6

This error appears when you are using multiple Git accounts on the same machine.

If you are using macOS then you can remove the saved credentials of github.com.

Please follow below steps to remove the github.com credentials.

  1. Open Keychain Access
  2. Find github
  3. Select the github.com and Right click on it
  4. Delete «github.com»
  5. Try again to Push or Pull to git and it will ask for the credentials.
  6. Enter valid credentials for repository account.
  7. Done

    enter image description here

brian d foy's user avatar

brian d foy

127k31 gold badges204 silver badges581 bronze badges

answered Dec 3, 2018 at 11:11

Pratik Patel's user avatar

Pratik PatelPratik Patel

2,0993 gold badges22 silver badges29 bronze badges

2

In my case, Git is using Windows to store credentials.

All you have to do is remove the stored credentials stored in your Windows account:

Windows credentials menu

Peter Mortensen's user avatar

answered Mar 2, 2017 at 14:20

SoliQuiD's user avatar

SoliQuiDSoliQuiD

1,9931 gold badge23 silver badges29 bronze badges

2

You have to update it in your Credential Manager.

Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won’t throw any more error messages.

Stephen Rauch's user avatar

Stephen Rauch

46.7k31 gold badges109 silver badges131 bronze badges

answered Jun 18, 2018 at 23:45

ChiragBhalgami's user avatar

2

In Windows 2003 Server with «wincred»*, none of the other answers helped me. I had to use cmdkey.

  • cmdkey /list lists all stored credentials.
  • cmdkey /delete:Target deletes the credential with «Target» name.

cmdkey /list; cmdkey /delete:Target

(* By «wincred» I mean git config --global credential.helper wincred)

answered Dec 12, 2016 at 23:55

ericbn's user avatar

ericbnericbn

9,6923 gold badges45 silver badges53 bronze badges

1

Using latest version of git for Windows on Windows 10 Professional and I had a similar issue whereby I have two different GitHub accounts and also a Bitbucket account so things got a bit confusing for VS2017, git extensions and git bash.

I first checked how git was handling my credentials with this command (run git bash with elevated commands or you get errors):

git config --list

I found the entry Credential Manager so I clicked on the START button > typed Credential Manager to and left-clicked on the credential manager yellow safe icon which launched the app. I then clicked on the Windows Credentials tabs and found the entry for my current git account which happened to be Bit-bucket so I deleted this account.

But this didn’t do the trick so the next step was to unset the credentials and I did this from the repository directory on my laptop that contains the GitHub project I am trying to push to the remote. I typed the following command:

git config --system --unset credential.helper

Then I did a git push and I was prompted for a GitHub username which I entered (the correct one I needed) and then the associated password and everything got pushed correctly.

I am not sure how much of an issue this is going forward most people probably work off the one repository but I have to work across several and using different providers so may encounter this issue again.

Community's user avatar

answered Sep 16, 2018 at 15:51

Trevor's user avatar

TrevorTrevor

1,5311 gold badge19 silver badges27 bronze badges

1

Got same error when doing a ‘git pull’ and this is how I fixed it.

  1. Change repo to HTTPS
  2. Run command git config --system --unset credential.helper
  3. Run command git config --system --add credential.helper manager
  4. Test command git pull
  5. Enter credentials in the login window that pops up.
  6. Git pull completed successfully.

Daniel Fisher  lennybacon's user avatar

answered Oct 1, 2018 at 3:25

Amer Bashoeb's user avatar

2

If you want git to forget old saved credentials and re-enter username and password, you can do that using below command:

git credential-cache exit

After running above command, if you try to push anything it will provide option to enter username and password.

answered Dec 13, 2019 at 8:25

amitshree's user avatar

amitshreeamitshree

1,9342 gold badges22 silver badges40 bronze badges

5

In case Git Credential Manager for Windows is used (which current versions usually do):

git credential-manager clear

This was added mid-2016. To check if credential manager is used:

git config --global credential.helper
→ manager

answered Jan 23, 2018 at 15:53

Simon A. Eugster's user avatar

Simon A. EugsterSimon A. Eugster

4,0544 gold badges35 silver badges31 bronze badges

  1. Go to C:Users<current-user>
  2. check for .git-credentials file
  3. Delete content or modify as per your requirement
  4. Restart your terminal

answered Jul 16, 2018 at 21:00

Dinesh Patil's user avatar

Dinesh PatilDinesh Patil

1,03210 silver badges13 bronze badges

1

If your credentials are stored in the credential helper (generally the case), the portable way to remove a password persisted for a specific host is to call git credential reject:

  • in one line:

    $ echo "url=https://appharbor.com" | git credential reject
    
  • or interactively:

    $ git credential reject
    protocol=https
    host=gitlab.com
    username=me@example.com
    ↵
    
    • ↵ is the Enter symbol, just hit Enter key twice at the end of input, don’t copy/paste it
    • The username doesn’t seem recognized by wincred, so avoid to filter by username on Windows

After that, to enter your new password, type git fetch.

https://git-scm.com/docs/git-credential

answered Jun 27, 2020 at 10:39

Marsu's user avatar

MarsuMarsu

7366 silver badges9 bronze badges

0

Need to login with respective github username and password

To Clear the username and password in windows

Control PanelUser AccountsCredential Manager

Edit the windows Credential

Remove the existing user and now go to command prompt write the push command it shows a github pop-up to enter the username/email and password .

Now we able to push the code after switching the user.

answered Feb 12, 2018 at 13:28

Amit K's user avatar

Amit KAmit K

1711 silver badge4 bronze badges

0

In my case, I couldn’t find the credentials saved in the Windows Credential Manager (Windows 7).

I was able to reset my credentials by executing

git config --global credential.helper wincred

It was honestly a hail Mary to see if it would wipe out my credentials and it actually worked.

answered Feb 22, 2017 at 17:53

Jeff LaFay's user avatar

Jeff LaFayJeff LaFay

12.7k13 gold badges72 silver badges100 bronze badges

1

Remove this line from your .gitconfig file located in the Windows’ currently logged-in user folder:

[credential]
helper = !"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe"

This worked for me and now when I push to remote it asks for my password again.

Peter Mortensen's user avatar

answered Aug 22, 2013 at 9:23

Liviu Mandras's user avatar

Liviu MandrasLiviu Mandras

6,4941 gold badge41 silver badges63 bronze badges

0

On Windows, at least, git remote show [remote-name] will work, e.g.

git remote show origin

answered May 2, 2019 at 19:57

Jason S's user avatar

Jason SJason S

182k161 gold badges593 silver badges953 bronze badges

4

This approach worked for me and should be agnostic of OS. It’s a little heavy-handed, but was quick and allowed me to reenter credentials.

Simply find the remote alias for which you wish to reenter credentials.

$ git remote -v 
origin  https://bitbucket.org/org/~username/your-project.git (fetch)
origin  https://bitbucket.org/org/~username/your-project.git (push)

Copy the project path (https://bitbucket.org/org/~username/your-project.git)

Then remove the remote

$ git remote remove origin

Then add it back

$ git remote add origin https://bitbucket.org/org/~username/your-project.git

answered Jul 16, 2020 at 16:08

Josh's user avatar

JoshJosh

6547 silver badges9 bronze badges

2

You can remove the line credential.helper=!github --credentials from the following file C:Program FilesGitmingw64etcgitconfig in order to remove the credentials for git

Liam's user avatar

Liam

26.7k27 gold badges120 silver badges184 bronze badges

answered May 25, 2016 at 4:19

Yoan Pumar's user avatar

Yoan PumarYoan Pumar

941 silver badge3 bronze badges

0

For macOS users :

This error appears when you are using multiple Git accounts on the same machine.

Please follow below steps to remove the github.com credentials.

  1. Go to Finder
  2. Go to Applications
  3. Go to Utilities Folder
  4. Open Keychain Access
  5. Select the github.com and Right click on it

Delete «github.com»

Try again to Push or Pull to git and it will ask for the credentials.
Enter valid credentials for repository account.
Done, now upvote the answer.

answered Dec 4, 2018 at 4:18

Suraj Chandgude's user avatar

No answer given worked for me. But here is what worked for me in the end:

rm -rf ~/.git-credentials

That will remove any credentials! When you use a new git command, you will be asked for a password!

answered Jan 7, 2022 at 8:34

Alex's user avatar

AlexAlex

41.1k81 gold badges234 silver badges447 bronze badges

1

Building from @patthoyts’s high-voted answer:

His answer uses but doesn’t explain local vs. global vs. system configs. The official git documentation for them is here and worth reading.

For example, I’m on Linux, and don’t use a system config, so I never use a --system flag, but do commonly need to differentiate between --local and --global configs.

My use case is I’ve got two Github crendentials; one for work, and one for play.

Here’s how I would handle the problem:

$ cd work
# do and commit work
$ git push origin develop
# Possibly prompted for credentials if I haven't configured my remotes to automate that. 
# We're assuming that now I've stored my "work" credentials with git's credential helper.

$ cd ~/play 
# do and commit play
$ git push origin develop                                                                   
remote: Permission to whilei/specs.git denied to whilei.                
fatal: unable to access 'https://github.com/workname/specs.git/': The requested URL returned error: 403

# So here's where it goes down:
$ git config --list | grep cred
credential.helper=store # One of these is for _local_
credential.helper=store # And one is for _global_

$ git config --global --unset credential.helper
$ git config --list | grep cred
credential.helper=store # My _local_ config still specifies 'store'
$ git config --unset credential.helper
$ git push origin develop
Username for 'https://github.com': whilei
Password for 'https://whilei@github.com':
Counting objects: 3, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.10 KiB | 1.10 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/whilei/specs.git
   b2ca528..f64f065  master -> master

# Now let's turn credential-helping back on:
$ git config --global credential.helper "store"
$ git config credential.helper "store"
$ git config --list | grep cred
credential.helper=store # Put it back the way it was.
credential.helper=store

It’s also worth noting that there are ways to avoid this problem altogether, for example, you can use ~/.ssh/config‘s with associated SSH keys for Github (one for work, one for play) and correspondingly custom-named remote hosts to solve authentication contextualizing too.

Bazer Con's user avatar

answered Dec 21, 2018 at 18:42

irbanana's user avatar

irbananairbanana

81012 silver badges19 bronze badges

What finally fixed this for me was to use GitHub desktop, go to repository settings, and remove user:pass@ from the repository url. Then, I attempted a push from the command line and was prompted for login credentials. After I put those in everything went back to normal. Both Visual Studio and command line are working, and of course, GitHub desktop.

GitHub Desktop->Repository->Repository Settings->Remote tab

Change Primary Remote Repository (origin) from:

https://pork@muffins@github.com/MyProject/MyProject.git

To:

https://github.com/MyProject/MyProject.git

Click «Save»

Credentials will be cleared.

answered Aug 4, 2018 at 8:40

Nick Pirocanac's user avatar

2

Update Actually useHttpPath is a git configuration, which should work for all GCMs. Corrected.

Summary of The Original Question

  • working with git on Windows
  • working on multiple repositories on GitHub
  • wrong credentials used for another GitHub repository

Although the title says «Remove credentials», the description leads me to the assumption that you may have multiple accounts on GitHub, e.g. for job-related vs. private projects. (At least that issue made me find this topic.)
If so read on, otherwise, ignore the answer, but it may come in handy at some time.

Reason

Git Credential Managers (short GCM) like Microsoft’s GCM for Windows store credentials per host by default.
This can be verified by checking the Windows Credential Manager (see other answers on how to access it on English, French, and German Windows versions).
So working with multiple accounts on the same host (here github.com) is not possible by default.

In October 2020 GCM for Windows got deprecated and superseded by GCM Core. The information here still applies to the new GCM and it should even use the credentials stored by GCM for Windows.

Solution

Configure git to include the full path to the repository as additional information for each credential entry. Also documented on GCM for Windows.
I personally prefer to include the HTTP(S) [repository] path to be able to use a separate account for each and every repository.

For all possible hosts:

git config --global credential.useHttpPath true

For github.com only:

git config --global credential.github.com.useHttpPath true

Have a look at the GCM and git docs and maybe you want to specify something different.

Vlad L.'s user avatar

Vlad L.

1541 silver badge9 bronze badges

answered Jun 20, 2020 at 22:59

Maddes's user avatar

MaddesMaddes

1811 silver badge4 bronze badges

In our case, clearing the password in the user’s .git-credentials file worked.

c:users[username].git-credentials

Bazer Con's user avatar

answered May 4, 2016 at 18:28

Fares's user avatar

FaresFares

6595 silver badges11 bronze badges

2

For Windows 10, go to below path,

Control PanelUser AccountsCredential Manager

There will be 2 tabs at this location,

  1. Web credentials and 2. Windows credentials.

Click on Windows credentials tab and here you can see your stored github credentials,
under «Generic credentials» heading.

You can remove those from here and try and re-clone — it will ask for username/password now as we have just removed the stored credential from the Windows 10 systems

answered Mar 3, 2020 at 8:28

AADProgramming's user avatar

AADProgrammingAADProgramming

5,88211 gold badges37 silver badges58 bronze badges

If this problem comes on a Windows machine, do the following.

  • Go to Credential Manager

    • in German, it is called: Anmeldeinformationsverwaltung
    • in French, it is called: Gestionnaire d’identification
    • in Polish, it is called: Menedżer poświadczeń
    • in Portuguese, it is called: Gerenciador de Credenciais
    • in Russian, it is called: Диспетчер учётных данных
    • in Spanish, it is called: Administrador de credenciales
    • in Norwegian, it is called: Legitimasjonsbehandling
    • in Czech, it is called: Správce pověření
    • in Dutch, it is called: Referentiebeheer

    Go to Credential Manager

  • Go to Windows Credentials

  • Delete the entries under Generic Credentials

    Go to Windows Credentials and Delete the entries under Generic Credentials

  • Try connecting again. This time, it should prompt you for the correct username and password.

brz's user avatar

brz

1,78120 silver badges21 bronze badges

answered Sep 21, 2016 at 6:24

Venkataramana Madugula's user avatar

16

The Git credential cache runs a daemon process which caches your credentials in memory and hands them out on demand. So killing your git-credential-cache—daemon process throws all these away and results in re-prompting you for your password if you continue to use this as the cache.helper option.

You could also disable use of the Git credential cache using git config --global --unset credential.helper. Then reset this, and you would continue to have the cached credentials available for other repositories (if any). You may also need to do git config --system --unset credential.helper if this has been set in the system configuration file (for example, Git for Windows 2).

On Windows you might be better off using the manager helper (git config --global credential.helper manager). This stores your credentials in the Windows credential store which has a Control Panel interface where you can delete or edit your stored credentials. With this store, your details are secured by your Windows login and can persist over multiple sessions. The manager helper included in Git for Windows 2.x has replaced the earlier wincred helper that was added in Git for Windows 1.8.1.1. A similar helper called winstore is also available online and was used with GitExtensions as it offers a more GUI driven interface. The manager helper offers the same GUI interface as winstore.

Extract from the Windows 10 support page detailing the Windows credential manager:

To open Credential Manager, type «credential manager» in the search box on the taskbar and select Credential Manager Control panel.

And then select Windows Credentials to edit (=remove or modify) the stored git credentials for a given URL.

Community's user avatar

answered Mar 13, 2013 at 10:38

patthoyts's user avatar

14

Retype:

$ git config credential.helper store

And then you will be prompted to enter your credentials again.

WARNING

Using this helper will store your passwords unencrypted on disk

Source: https://git-scm.com/docs/git-credential-store

answered Nov 18, 2014 at 18:55

aaafly's user avatar

aaaflyaaafly

2,8181 gold badge14 silver badges11 bronze badges

5

I faced the same issue as the OP. It was taking my old Git credentials stored somewhere on the system and I wanted to use Git with my new credentials, so I ran the command

$ git config --system --list

It showed

credential.helper=manager

Whenever I performed git push it was taking my old username which I set long back, and I wanted to use new a GitHub account to push changes. I later found that my old GitHub account credentials was stored under
Control PanelUser AccountsCredential ManagerManage Windows Credentials.

Manage Windows Credentials

I just removed these credentials and when I performed git push it asked me for my GitHub credentials, and it worked like a charm.

Peter Mortensen's user avatar

answered Sep 20, 2016 at 11:09

Mourya's user avatar

MouryaMourya

2,2803 gold badges18 silver badges24 bronze badges

7

Try using the below command.

git credential-manager

Here you can get various options to manage your credentials (check the below screen).

Enter image description here

Or you can even directly try this command:

git credential-manager uninstall

This will start prompting for passwords again on each server interaction request.

Peter Mortensen's user avatar

answered Aug 11, 2016 at 5:57

Himanshu Aggarwal's user avatar

8

I found something that worked for me. When I wrote my comment to the OP I had failed to check the system config file:

git config --system -l

shows a

credential.helper=!github --credentials

line. I unset it with

git config --system --unset credential.helper

and now the credentials are forgotten.

Jaap's user avatar

Jaap

60913 silver badges18 bronze badges

answered Nov 18, 2015 at 11:21

damix911's user avatar

damix911damix911

4,1051 gold badge28 silver badges43 bronze badges

3

git config --list

will show credential.helper = manager (this is on a windows machine)

To disable this cached username/password for your current local git folder, simply enter

git config credential.helper ""

This way, git will prompt for password every time, ignoring what’s saved inside «manager».

answered Sep 25, 2017 at 14:51

Zhe Hu's user avatar

Zhe HuZhe Hu

3,6474 gold badges32 silver badges42 bronze badges

6

This error appears when you are using multiple Git accounts on the same machine.

If you are using macOS then you can remove the saved credentials of github.com.

Please follow below steps to remove the github.com credentials.

  1. Open Keychain Access
  2. Find github
  3. Select the github.com and Right click on it
  4. Delete «github.com»
  5. Try again to Push or Pull to git and it will ask for the credentials.
  6. Enter valid credentials for repository account.
  7. Done

    enter image description here

brian d foy's user avatar

brian d foy

127k31 gold badges204 silver badges581 bronze badges

answered Dec 3, 2018 at 11:11

Pratik Patel's user avatar

Pratik PatelPratik Patel

2,0993 gold badges22 silver badges29 bronze badges

2

In my case, Git is using Windows to store credentials.

All you have to do is remove the stored credentials stored in your Windows account:

Windows credentials menu

Peter Mortensen's user avatar

answered Mar 2, 2017 at 14:20

SoliQuiD's user avatar

SoliQuiDSoliQuiD

1,9931 gold badge23 silver badges29 bronze badges

2

You have to update it in your Credential Manager.

Go to Control Panel > User Accounts > Credential Manager > Windows Credentials. You will see Git credentials in the list (e.g. git:https://). Click on it, update the password, and execute git pull/push command from your Git bash and it won’t throw any more error messages.

Stephen Rauch's user avatar

Stephen Rauch

46.7k31 gold badges109 silver badges131 bronze badges

answered Jun 18, 2018 at 23:45

ChiragBhalgami's user avatar

2

In Windows 2003 Server with «wincred»*, none of the other answers helped me. I had to use cmdkey.

  • cmdkey /list lists all stored credentials.
  • cmdkey /delete:Target deletes the credential with «Target» name.

cmdkey /list; cmdkey /delete:Target

(* By «wincred» I mean git config --global credential.helper wincred)

answered Dec 12, 2016 at 23:55

ericbn's user avatar

ericbnericbn

9,6923 gold badges45 silver badges53 bronze badges

1

Using latest version of git for Windows on Windows 10 Professional and I had a similar issue whereby I have two different GitHub accounts and also a Bitbucket account so things got a bit confusing for VS2017, git extensions and git bash.

I first checked how git was handling my credentials with this command (run git bash with elevated commands or you get errors):

git config --list

I found the entry Credential Manager so I clicked on the START button > typed Credential Manager to and left-clicked on the credential manager yellow safe icon which launched the app. I then clicked on the Windows Credentials tabs and found the entry for my current git account which happened to be Bit-bucket so I deleted this account.

But this didn’t do the trick so the next step was to unset the credentials and I did this from the repository directory on my laptop that contains the GitHub project I am trying to push to the remote. I typed the following command:

git config --system --unset credential.helper

Then I did a git push and I was prompted for a GitHub username which I entered (the correct one I needed) and then the associated password and everything got pushed correctly.

I am not sure how much of an issue this is going forward most people probably work off the one repository but I have to work across several and using different providers so may encounter this issue again.

Community's user avatar

answered Sep 16, 2018 at 15:51

Trevor's user avatar

TrevorTrevor

1,5311 gold badge19 silver badges27 bronze badges

1

Got same error when doing a ‘git pull’ and this is how I fixed it.

  1. Change repo to HTTPS
  2. Run command git config --system --unset credential.helper
  3. Run command git config --system --add credential.helper manager
  4. Test command git pull
  5. Enter credentials in the login window that pops up.
  6. Git pull completed successfully.

Daniel Fisher  lennybacon's user avatar

answered Oct 1, 2018 at 3:25

Amer Bashoeb's user avatar

2

If you want git to forget old saved credentials and re-enter username and password, you can do that using below command:

git credential-cache exit

After running above command, if you try to push anything it will provide option to enter username and password.

answered Dec 13, 2019 at 8:25

amitshree's user avatar

amitshreeamitshree

1,9342 gold badges22 silver badges40 bronze badges

5

In case Git Credential Manager for Windows is used (which current versions usually do):

git credential-manager clear

This was added mid-2016. To check if credential manager is used:

git config --global credential.helper
→ manager

answered Jan 23, 2018 at 15:53

Simon A. Eugster's user avatar

Simon A. EugsterSimon A. Eugster

4,0544 gold badges35 silver badges31 bronze badges

  1. Go to C:Users<current-user>
  2. check for .git-credentials file
  3. Delete content or modify as per your requirement
  4. Restart your terminal

answered Jul 16, 2018 at 21:00

Dinesh Patil's user avatar

Dinesh PatilDinesh Patil

1,03210 silver badges13 bronze badges

1

If your credentials are stored in the credential helper (generally the case), the portable way to remove a password persisted for a specific host is to call git credential reject:

  • in one line:

    $ echo "url=https://appharbor.com" | git credential reject
    
  • or interactively:

    $ git credential reject
    protocol=https
    host=gitlab.com
    username=me@example.com
    ↵
    
    • ↵ is the Enter symbol, just hit Enter key twice at the end of input, don’t copy/paste it
    • The username doesn’t seem recognized by wincred, so avoid to filter by username on Windows

After that, to enter your new password, type git fetch.

https://git-scm.com/docs/git-credential

answered Jun 27, 2020 at 10:39

Marsu's user avatar

MarsuMarsu

7366 silver badges9 bronze badges

0

Need to login with respective github username and password

To Clear the username and password in windows

Control PanelUser AccountsCredential Manager

Edit the windows Credential

Remove the existing user and now go to command prompt write the push command it shows a github pop-up to enter the username/email and password .

Now we able to push the code after switching the user.

answered Feb 12, 2018 at 13:28

Amit K's user avatar

Amit KAmit K

1711 silver badge4 bronze badges

0

In my case, I couldn’t find the credentials saved in the Windows Credential Manager (Windows 7).

I was able to reset my credentials by executing

git config --global credential.helper wincred

It was honestly a hail Mary to see if it would wipe out my credentials and it actually worked.

answered Feb 22, 2017 at 17:53

Jeff LaFay's user avatar

Jeff LaFayJeff LaFay

12.7k13 gold badges72 silver badges100 bronze badges

1

Remove this line from your .gitconfig file located in the Windows’ currently logged-in user folder:

[credential]
helper = !"C:/Program Files (x86)/GitExtensions/GitCredentialWinStore/git-credential-winstore.exe"

This worked for me and now when I push to remote it asks for my password again.

Peter Mortensen's user avatar

answered Aug 22, 2013 at 9:23

Liviu Mandras's user avatar

Liviu MandrasLiviu Mandras

6,4941 gold badge41 silver badges63 bronze badges

0

On Windows, at least, git remote show [remote-name] will work, e.g.

git remote show origin

answered May 2, 2019 at 19:57

Jason S's user avatar

Jason SJason S

182k161 gold badges593 silver badges953 bronze badges

4

This approach worked for me and should be agnostic of OS. It’s a little heavy-handed, but was quick and allowed me to reenter credentials.

Simply find the remote alias for which you wish to reenter credentials.

$ git remote -v 
origin  https://bitbucket.org/org/~username/your-project.git (fetch)
origin  https://bitbucket.org/org/~username/your-project.git (push)

Copy the project path (https://bitbucket.org/org/~username/your-project.git)

Then remove the remote

$ git remote remove origin

Then add it back

$ git remote add origin https://bitbucket.org/org/~username/your-project.git

answered Jul 16, 2020 at 16:08

Josh's user avatar

JoshJosh

6547 silver badges9 bronze badges

2

You can remove the line credential.helper=!github --credentials from the following file C:Program FilesGitmingw64etcgitconfig in order to remove the credentials for git

Liam's user avatar

Liam

26.7k27 gold badges120 silver badges184 bronze badges

answered May 25, 2016 at 4:19

Yoan Pumar's user avatar

Yoan PumarYoan Pumar

941 silver badge3 bronze badges

0

For macOS users :

This error appears when you are using multiple Git accounts on the same machine.

Please follow below steps to remove the github.com credentials.

  1. Go to Finder
  2. Go to Applications
  3. Go to Utilities Folder
  4. Open Keychain Access
  5. Select the github.com and Right click on it

Delete «github.com»

Try again to Push or Pull to git and it will ask for the credentials.
Enter valid credentials for repository account.
Done, now upvote the answer.

answered Dec 4, 2018 at 4:18

Suraj Chandgude's user avatar

No answer given worked for me. But here is what worked for me in the end:

rm -rf ~/.git-credentials

That will remove any credentials! When you use a new git command, you will be asked for a password!

answered Jan 7, 2022 at 8:34

Alex's user avatar

AlexAlex

41.1k81 gold badges234 silver badges447 bronze badges

1

Building from @patthoyts’s high-voted answer:

His answer uses but doesn’t explain local vs. global vs. system configs. The official git documentation for them is here and worth reading.

For example, I’m on Linux, and don’t use a system config, so I never use a --system flag, but do commonly need to differentiate between --local and --global configs.

My use case is I’ve got two Github crendentials; one for work, and one for play.

Here’s how I would handle the problem:

$ cd work
# do and commit work
$ git push origin develop
# Possibly prompted for credentials if I haven't configured my remotes to automate that. 
# We're assuming that now I've stored my "work" credentials with git's credential helper.

$ cd ~/play 
# do and commit play
$ git push origin develop                                                                   
remote: Permission to whilei/specs.git denied to whilei.                
fatal: unable to access 'https://github.com/workname/specs.git/': The requested URL returned error: 403

# So here's where it goes down:
$ git config --list | grep cred
credential.helper=store # One of these is for _local_
credential.helper=store # And one is for _global_

$ git config --global --unset credential.helper
$ git config --list | grep cred
credential.helper=store # My _local_ config still specifies 'store'
$ git config --unset credential.helper
$ git push origin develop
Username for 'https://github.com': whilei
Password for 'https://whilei@github.com':
Counting objects: 3, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.10 KiB | 1.10 MiB/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), completed with 1 local object.
To https://github.com/whilei/specs.git
   b2ca528..f64f065  master -> master

# Now let's turn credential-helping back on:
$ git config --global credential.helper "store"
$ git config credential.helper "store"
$ git config --list | grep cred
credential.helper=store # Put it back the way it was.
credential.helper=store

It’s also worth noting that there are ways to avoid this problem altogether, for example, you can use ~/.ssh/config‘s with associated SSH keys for Github (one for work, one for play) and correspondingly custom-named remote hosts to solve authentication contextualizing too.

Bazer Con's user avatar

answered Dec 21, 2018 at 18:42

irbanana's user avatar

irbananairbanana

81012 silver badges19 bronze badges

What finally fixed this for me was to use GitHub desktop, go to repository settings, and remove user:pass@ from the repository url. Then, I attempted a push from the command line and was prompted for login credentials. After I put those in everything went back to normal. Both Visual Studio and command line are working, and of course, GitHub desktop.

GitHub Desktop->Repository->Repository Settings->Remote tab

Change Primary Remote Repository (origin) from:

https://pork@muffins@github.com/MyProject/MyProject.git

To:

https://github.com/MyProject/MyProject.git

Click «Save»

Credentials will be cleared.

answered Aug 4, 2018 at 8:40

Nick Pirocanac's user avatar

2

Update Actually useHttpPath is a git configuration, which should work for all GCMs. Corrected.

Summary of The Original Question

  • working with git on Windows
  • working on multiple repositories on GitHub
  • wrong credentials used for another GitHub repository

Although the title says «Remove credentials», the description leads me to the assumption that you may have multiple accounts on GitHub, e.g. for job-related vs. private projects. (At least that issue made me find this topic.)
If so read on, otherwise, ignore the answer, but it may come in handy at some time.

Reason

Git Credential Managers (short GCM) like Microsoft’s GCM for Windows store credentials per host by default.
This can be verified by checking the Windows Credential Manager (see other answers on how to access it on English, French, and German Windows versions).
So working with multiple accounts on the same host (here github.com) is not possible by default.

In October 2020 GCM for Windows got deprecated and superseded by GCM Core. The information here still applies to the new GCM and it should even use the credentials stored by GCM for Windows.

Solution

Configure git to include the full path to the repository as additional information for each credential entry. Also documented on GCM for Windows.
I personally prefer to include the HTTP(S) [repository] path to be able to use a separate account for each and every repository.

For all possible hosts:

git config --global credential.useHttpPath true

For github.com only:

git config --global credential.github.com.useHttpPath true

Have a look at the GCM and git docs and maybe you want to specify something different.

Vlad L.'s user avatar

Vlad L.

1541 silver badge9 bronze badges

answered Jun 20, 2020 at 22:59

Maddes's user avatar

MaddesMaddes

1811 silver badge4 bronze badges

In our case, clearing the password in the user’s .git-credentials file worked.

c:users[username].git-credentials

Bazer Con's user avatar

answered May 4, 2016 at 18:28

Fares's user avatar

FaresFares

6595 silver badges11 bronze badges

2

For Windows 10, go to below path,

Control PanelUser AccountsCredential Manager

There will be 2 tabs at this location,

  1. Web credentials and 2. Windows credentials.

Click on Windows credentials tab and here you can see your stored github credentials,
under «Generic credentials» heading.

You can remove those from here and try and re-clone — it will ask for username/password now as we have just removed the stored credential from the Windows 10 systems

answered Mar 3, 2020 at 8:28

AADProgramming's user avatar

AADProgrammingAADProgramming

5,88211 gold badges37 silver badges58 bronze badges

Git Credential Manager for Windows

The Git Credential Manager for Windows (GCM) provides secure Git credential storage for Windows.
GCM provides multi-factor authentication support for Azure DevOps, Team Foundation Server, GitHub, and BitBucket.

Usage

After installation, Git will use the Git Credential Manager for Windows and you will only need to interact with any authentication dialogs asking for credentials.
The GCM stays invisible as much as possible, so ideally you’ll forget that you’re depending on GCM at all.

Assuming the GCM has been installed, using your favorite Windows console (Command Prompt, PowerShell, ConEmu, etc.), use the following command to interact directly with the GCM.

git credential-manager [<command> [<args>]]

Commands

delete (deprecated)

Removes stored credentials for a given URL.
Any future attempts to authenticate with the remote will require authentication steps to be completed again.

This method is being deprecated and users should use «git credential reject» instead

deploy [—path <installation_path>] [—passive] [—force]

Deploys the Git Credential Manager for Windows package and sets Git configuration to use the helper.

deploy —path <installation_path>

Specifies a path (<installation_path>) for the installer to deploy to.
If a path is provided, the installer will not seek additional Git installations to modify.

deploy —passive

Instructs the installer to not prompt the user for input during deployment and restricts output to error messages only.

When combined with --force all output is eliminated; only the return code can be used to validate success.

deploy —force

Instructs the installer to proceed with deployment even if prerequisites are not met or errors are encountered.

When combined with --passive all output is eliminated; only the return code can be used to validate success.

remove [—path <installation_path>] [—passive] [—force]

Removes the Git Credential Manager for Windows package and unsets Git configuration to no longer use the helper.

remove —path <installation_path>

Specifies a path (<installation_path>) for the installer to remove from.
If a path is provided, the installer will not seek additional Git installations to modify.

remove —passive

Instructs the installer to not prompt the user for input during removal and restricts output to error messages only.

When combined with --force all output is eliminated; only the return code can be used to validate success.

remove —force

Instructs the installer to proceed with removal even if prerequisites are not met or errors are encountered.

When combined with --passive all output is eliminated; only the return code can be used to validate success.

version

Displays the current version.

clear

Synonym for delete.

install

Synonym for deploy.

uninstall

Synonym for remove.

get / store / erase / fill / approve / reject

Commands for interaction with Git.

1 minute read

| Suggest an edit | Issue? Question?

A fun git challenge! I had to make a request against a remote repository in git. The only issue is that only a shared GitHub account had access, not my own account (due to a vendor limitation). So when I occasionally needed to use this remote, I would have to log out and log in as the service account. It just seemed a bit messy.

I found a reasonable way to do this, and I’ll run through the steps below. (Have a better way? I’d love to hear about it in the comments!)

  • Login with the shared account. Since I had the credentials, I did this via a normal browser session (in a private window since I was just logging in once.)
  • Generate a personal access token. If you’re unfamiliar with this, you can follow the steps in the GitHub docs.
  • Store in my password manager. This access token is as good as a password, so I treat it with the respect it deserves.

Add the Remote in Git

  • Add the remote if it’s not already added: git remote add REMOTE_NAME THE_URL_OF_THE_REMOTE

Unset the git credential manager temporarily

I’m doing the steps here manually but it could almost certainly be automated in a tiny script.

  • Check the value of credential manager: git config --system credential.helper. Note this value for later; you will need it to set things back.
  • Unset the credential manager, which will prompt you for PW going forward: git config --system --unset credential.helper

Running the command

  • Run your applicable command, e.g. git fetch upstream in my case. You’ll be prompted for a password.
  • Use the shared account username, and the personal access token as the password

Return things to normal

  • Set the value of the credential manager back to what it was, e.g manager-core in my case: git config --system credential.helper manager-core

That will let you quickly do one-time operations as the other account without needing to log out / in, mess up your other git credentials, etc.

Happy gitting!

Использование последней версии git для Windows в Windows 10 Professional, и у меня была аналогичная проблема, в которой у меня есть две разные учетные записи GitHub, а также учетная запись Bitbucket, поэтому все немного запуталось в VS2017, git-расширениях и git-bash.

Сначала я проверил, как git обрабатывает мои учетные данные с помощью этой команды (запустите git bash с повышенными командами или вы получите ошибки):

git config --list

Я нашел учетную запись Credential Manager, поэтому я нажал кнопку «СТАРТ»> набрал «Диспетчер учетных данных» и нажал левой кнопкой мыши на значке безопасного значка администратора, который запустил приложение. Затем я нажал вкладки учетных данных Windows и нашел запись для моей текущей учетной записи git, которая оказалась Bitbucket, поэтому я удалил эту учетную запись.

Но это не помогло, поэтому следующим шагом было сбросить учетные данные, и я сделал это из каталога репозитория на моем ноутбуке, который содержит проект GitHub, который я пытаюсь нажать на пульт. Я набрал следующую команду:

git config --system --unset credential.helper

Затем я сделал git push, и мне было предложено ввести имя пользователя GitHub, которое я ввел (правильный, который мне нужен), а затем связанный пароль, и все получилось правильно.

Я не уверен, насколько большая проблема связана с тем, что большинство людей, вероятно, работают с одним репо, но мне приходится работать по нескольким и использовать разные провайдеры, чтобы снова столкнуться с этой проблемой.

если ваш компьютер защищен или вы не заботитесь о безопасности паролей, это может быть достигнуто очень просто. При условии, что удаленный репозиторий на GitHub и origin это ваше локальное имя для удаленного репозитория, используйте эту команду

git remote set-url --push origin https://<username>:<password>@github.com/<repo>

The --push флаг гарантирует, что это изменяет URL репозитория для только. (Вопрос, заданный в исходном сообщении, касается только. Требуется имя пользователя + пароль только для операций push-это нормальная настройка для общественные репозитории на GitHub . Обратите внимание, что частная репозитории на GitHub также потребуют имя пользователя+пароль для операций извлечения и извлечения, поэтому для частного репозитория вы не захотите использовать --push flag …)

предупреждение: это по своей сути небезопасно, потому что:

  1. ваш интернет-провайдер или любой, кто регистрирует доступ к сети, может легко
    см. пароль в виде обычного текста в разделе URL;

  2. любой, кто получает доступ к вашему компьютеру, может просмотреть ваш пароль с помощью git remote show origin.

вот почему использование ключа SSH является принятым ответом.

даже ключ SSH-это не совсем безопасно. Любой, кто получает доступ к вашему компьютеру, может, например, сделать толчки, которые разрушают ваш репозиторий или, что еще хуже, push — коммиты, вносящие тонкие изменения в ваш код. (Все нажатые коммиты, очевидно, хорошо видны на GitHub. Но если кто-то хотел изменить ваш код тайно, они могли --amend предыдущая фиксация без изменения сообщения фиксации, а затем принудительно нажмите ее. Это было бы незаметно и довольно трудно заметить на практике.)

но раскрывая свой пароль хуже. Если злоумышленник узнает ваше имя пользователя+пароль, они могут сделать такие вещи, как заблокировать вас из вашей собственной учетной записи, удалить вашу учетную запись, навсегда удалить репозиторий, так далее.


как вариант — для простоты и безопасность — вы можете поставить только ваше имя пользователя в URL, так что вам придется вводить пароль каждый раз, когда вы git push но вам не придется давать свое имя пользователя каждый раз. (Мне очень нравится этот подход, вводя пароль дает мне паузу, чтобы думать каждый раз, когда я git push, так что я не могу git push случайно.)

git remote set-url --push origin https://<username>@github.com/<repo>

Понравилась статья? Поделить с друзьями:
  • Gns3 скачать windows 10 64 bit
  • Gnomoria не запускается на windows 10
  • Gnome skin pack для windows 7
  • Gnome disk utility скачать для windows
  • Gigabyte h510m h поддержка windows 7