Configuring user and password with Git Bash Configuring user and password with Git Bash git git

Configuring user and password with Git Bash


Make sure you are using the SSH URL for the GitHub repository rather than the HTTPS URL. It will ask for username and password when you are using HTTPS and not SSH. You can check the file .git/config or run git config -e or git remote show origin to verify the URL and change it if needed.

You can change the URL with: [1]

git remote set-url origin git+ssh://git@github.com/username/reponame.git

[1] This portion incorporates the answer to this question.


From Git Bash I prefer to run the command:

git config --global credential.helper wincred

At that point running a command like git pull and entering your credentials one time should have it stored for future use. Git has a built-in credentials system that works in different OS environments. You can get more details here: 7.14 Git Tools - Credential Storage


For those who are using access token and a Windows environment, there is a simple way to do it:

Start menu → Credential ManagerWindows Credentials → find the line (Git: https://whatever/your-repository/url) → edit,user name is "github_username" and password is your access token.