Github keeps asking for username and password

How to solve the issue of username and password prompts each time you push or pull a repository from github

Published: 06 Jun 2012

If you're using https protocol for your remote.origin.url and you continually get prompted for your username and password, you can make the following change to prevent the prompts in the future:

If your clone url looks something like this:

https://github.com/username/project.git

Add the username:password bit using the following command from your project root directory:

git config remote.origin.url https://username:password@github.com/username/project.git

Note that this means your password will be stored in plain text in your .git/config file.

An alternative is to clone your project using ssh protocol.