简体   繁体   中英

How do I change my git account credentials without Windows Credentials Manager

I have my git client on Windows 10 machine. I attempted the push my code with invalid credentials once. Now whenever when I try to push the commit, it gives me HTTP Basic:

Access Denied fatal: Authentication failed exception.

This is due to my previous invalid credentials, I assume. I tried to change my saved credentials using Windows Credentials Manager but WCM is blocked in my company because of security policy.

Can you please help me, how I can change my already stored credentials without Windows Credentials Manager?

$ git push origin master
remote: HTTP Basic: Access denied
fatal: Authentication failed for 'https://my-host/gitlab/teamx/myapp.git/'

To save credentials, you can clone a repository by setting a username and password on the command line:

$ git clone https://<USERNAME>:<PASSWORD>@github.com/path/to/repo.git

The username and password will be stored in the .git/config file as a part of the remote repository URL.

If you have already cloned a repository without setting username and password on the command line, you can always update the remote URL by running the following command:

$ git remote set-url origin https://<USERNAME>:<PASSWORD>@github.com/path/to/repo.git

To save username and password to an existing repository, run the following command to enable credentials storage in your Git repository:

$ git config [--global] credential.helper store

( --global to enable credentials globally)

When credentials storage is enabled, the first time you pull or push from the remote Git repository, you will be asked for a username and password , and then it will be saved in ~/.git-credentials .

During the next communications with the remote Git repository, you won't have to provide the username and password .

Each credential in ~/.git-credentials file is stored on its own line as a URL like:

https://<USERNAME>:<PASSWORD>@github.com

Look also at this question . You can that also do with SSH-authentication (look at this question).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM