Version Control System

How to fix Git always asking for my Username and Password


So many people have complained about Git asking them for their username and password each time they try to access GitHub even after configuring it. This is one common issue experienced by people who use the HTTPS clone URL for their repository. In this article, I will be showing you how to fix Git always asking for my Username and Password. You may want to read more on Git How to Setup HTTPS users using Git credentials and Pushing Code to AWS CodeCommit, How to Set Up and Use an Upstream Branch in Git, Fix Git is not recognised as an internal or external command and How to fix fatal Git error refusing to merge unrelated histories

Many people find using an HTTPS remote URL easier than using SSH. Also, how it works its way through firewalls and proxies. But the issue here is that it prompts you to enter your GitHub user credentials every time you pull or push a repository.


Please see How to install Git on macOS, Windows Profile: How to determine your windows username. Some Common Cisco ASA Commands, and how to clone a repository and install software from GitHub on Windows. How to lookup a username and machine name using an IP address on windows.

How to fix Git always asking for my Username and Password

Follow these steps on How to Fix Git always asking for my Username and Password.

1: Try to update the URL of the origin remote using SSH instead of using HTTPS;

git remote set-url origin

2: You can make Git store your username and password.

git config --global credential.helper store

3: You can cache or save your Username and Password for a session.

git config --global credential.helper cache

4: You can set a timeout for the settings above.

git config --global credential.helper 'cache --timeout=600'

Immediately you do these Git will no longer be asking you for your Username and Password.

Please due to security reasons it is recommended that you use SSH to connect with GitHub. Especially when you are using another person’s system or working for your company. SSH is more secure and will not ask you to supply your credentials every time before you can connect to GitHub.

I hope you found this blog post on How to Fix Git always asking for my Username and Password interesting and helpful. In case you have any questions do not hesitate to ask in the comment section.

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x