Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove github login popup asking for credentials?

Tags:

git

github

I changed my Github account recently. I have my new username and email stored in global .gitconfig:

[filter "lfs"]
    process = git-lfs filter-process
    required = true
    clean = git-lfs clean -- %f
    smudge = git-lfs smudge -- %f
[user]
    name = myusername
    email = [email protected]
[credential]
    helper = store
    username = myusername

and my password for github in .git-credentials.

Every time I push to my remote repository Github login pops up asking me for my credentials.

Github login popup

And when I cancel it everything works fine. I don't need to enter username or password. Remote is updated. How to get rid of that popup? I didn't have that behaviour before changing account credentials.

like image 376
Denis B Avatar asked Dec 27 '20 15:12

Denis B


People also ask

How do I stop Git from asking for credentials?

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

How do I stop Git push from asking for username and password?

Issue the command git fetch/push/pull. You will not then be prompted for the password.


2 Answers

Git has the concept of multiple credential managers. When you installed Git for Windows, it came with the Git Credential Manager for Windows (either the old one or Core), and you probably answered a question about whether you wanted to use it or not.

Somewhere in an earlier config file, such as the system one, there's a setting that looks like credential.helper = manager. Because Git invokes the credential managers in order and uses the first one that provides it credentials, it first asks the manager one specified at the system level, causing the pop-up, and then invokes the store one in your local config file.

What likely happened is that your old account was using the manager helper but the new one is using the store helper for saving your password, so the prompt didn't show up for manager because it had your credentials saved.

If you don't want to the manager helper, run git config -l --show-origin to find the file which has the other credential.helper setting and then edit it to remove that option.

Do note that the manager helper is going to be more secure than storing your credentials in a file on disk (since it will be encrypted), and it will use a personal access token, which GitHub will require in the future, so you may want to use the popup prompt to get credentials and remove the store helper instead.

like image 63
bk2204 Avatar answered Oct 21 '22 23:10

bk2204


I got this same problem today, got an email from Github that the way I accessed the git has been deprecated, so solved it as below:

  1. uninstall the git software ( Or, using Run > appwiz.cpl )

  2. install new git from here - https://git-scm.com/downloads

  3. for one time save password - run the below command for this project:

    git config --global credential.helper store

  4. now run below:

    git pull

Note:

  1. To run the 3rd & 4th command, you should already be in a git folder (where you ran the git clone https://github.com/../...git command)

  2. This issue occurred because now the GitHub changed it's authentication:
    from git credential manager
    to git credential manager core
    See below for more information

Basic authentication using a password to Git is deprecated and will soon no longer work. Visit https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

like image 2
Manohar Reddy Poreddy Avatar answered Oct 21 '22 23:10

Manohar Reddy Poreddy