Every time you push code to GitHub, Git asks for your username and password. The first few times it is only annoying. After a week of typing it again and again, it slows down every small update you make.
The cause is usually simple: Git has nowhere safe to remember your login. Once you set up a credential helper or switch to SSH keys, the repeated prompts stop.
This guide walks through the quickest fixes for Windows, macOS, and Linux, and explains why using a personal access token matters on GitHub today.
Quick Answer
Git keeps asking for your password because no credential helper is storing it, or because your remote uses HTTPS with an expired token. Fix it by enabling a credential helper such as git config --global credential.helper manager on Windows, or switch your remote to SSH with git remote set-url origin git@github.com:user/repo.git so you never type a password on push.
Why Git Asks for Your Username and Password Every Time
When you push over HTTPS, Git must prove who you are to the remote server on every connection. If nothing stores that proof, Git has no choice but to ask you again.
There are four common reasons behind the repeated prompt:
- No credential helper is configured: Git can ask your operating system to store credentials, but only if a helper is turned on.
- You are using your account password on GitHub: GitHub no longer accepts account passwords for Git operations. You must use a personal access token instead, and an old password attempt will keep failing and re-prompting.
- A saved credential is wrong or expired: An old token stored in your system may have expired, so Git keeps asking for a working one.
- Your remote URL is HTTPS: HTTPS remotes rely on passwords or tokens. SSH remotes use keys instead, so they do not prompt for a password on every push.
Understanding which reason applies to you makes the fix much faster. In most beginner setups, enabling the credential manager and using a token solves the problem in a few minutes.
If your Git setup itself is brand new, our detailed walkthrough for installing Git on Windows 11 shows the setup options that include the credential manager by default.
Fix 1: Turn On the Git Credential Manager
The credential manager stores your login securely in your operating system after you enter it once. It is the easiest fix if you want to stay with HTTPS.
On Windows
- Open Git Bash or Command Prompt.
- Run
git config --global credential.helper managerto enable the manager. - Run
git pushin your project. A sign-in window should appear. - Sign in with your GitHub account in the browser window, or paste a personal access token if Git asks for a password.
- Push again. This time Git should not ask, because Windows now stores the credential for you.
Git for Windows normally installs Git Credential Manager automatically. The config command above simply makes sure Git is actually using it.
On macOS
- Open Terminal in your project folder.
- Run
git config --global credential.helper osxkeychainto use the macOS Keychain. - Run
git pushand enter your username and a personal access token as the password. - Your Mac saves the token in the Keychain, and future pushes use it silently.
On Linux
- For a simple temporary cache, run
git config --global credential.helper cache, which remembers credentials for a short time in memory. - For longer storage, run
git config --global credential.helper store, which saves credentials in a plain file in your home folder. - Be aware that the
storeoption is less secure than a system keychain, so use it only on a personal computer you control.
After enabling any helper, always test with two pushes in a row. The second push tells you whether the storage really worked. The official Git credentials documentation explains how each helper behaves if you need the full details.
Fix 2: Use a Personal Access Token Instead of Your Password
Many repeated prompts happen because GitHub rejects a normal account password. Since 2021, Git operations over HTTPS require a personal access token, often shortened to PAT.
A token works like a special password made only for Git. You can create one with limited permissions and delete it at any time if you think it leaked.
- On GitHub, open Settings, then Developer settings, then Personal access tokens.
- Create a new token, give it a clear name such as “My laptop Git”, and select the
reposcope for private repositories. - Copy the token immediately. GitHub will not show it to you again.
- Run
git pushand, when Git asks for a password, paste the token instead. Pasting in some terminals shows no characters, which is normal. - Make sure your credential helper is enabled, so you only need to paste the token once.
Follow the steps in the official GitHub guide to managing personal access tokens when you create yours, and store the token in a password manager until you have saved it in Git.
Never share a token in chat, screenshots, or code. Treat it with the same care as a real password.
Fix 3: Switch Your Remote from HTTPS to SSH
If you push often, SSH is the most comfortable long-term fix. You create a key pair once, add the public key to GitHub, and then pushes happen without a password prompt.
- Check your current remote with
git remote -v. If the address starts withhttps://, it is an HTTPS remote. - On GitHub, open your repository and copy its SSH address, which looks like
git@github.com:username/repository.git. - Run
git remote set-url origin git@github.com:username/repository.git, replacing the address with your real one. - Run
git remote -vagain to confirm the change. - Run
git push. If your SSH key is set up, the push should complete without asking for a GitHub password.
You may see a prompt for your SSH key passphrase if you created one. That is different from your account password, and an SSH agent can remember it for your session.
This fix needs working SSH keys first. Once they are in place, most developers find SSH simpler than managing tokens that expire.
Fix 4: Remove a Wrong Saved Credential
Sometimes the helper is on, but it keeps handing Git an old, wrong password. In that case, you need to delete the saved entry and let Git ask one final time.
On Windows, open Credential Manager, find entries related to GitHub under Windows Credentials, and remove them. On macOS, open Keychain Access, search for GitHub, and delete the old internet password entry there.
- Delete the old GitHub credential from your system store.
- Run
git pushin your project. - When prompted, enter your username and a valid personal access token.
- Push a second time to confirm the new credential was saved correctly.
This clean start fixes stubborn cases where every other setting already looks correct.
Common Mistakes to Avoid
- Typing your GitHub account password: GitHub does not accept it for Git pushes anymore. Always use a personal access token with HTTPS.
- Enabling the cache helper and expecting permanent storage: The
cachehelper forgets credentials after a short timeout and when you restart. Use a system keychain or manager for lasting storage. - Storing tokens inside the remote URL: Putting a token in a URL inside scripts or shared files can leak it. Let the credential manager store it instead.
- Switching to SSH without adding the key to GitHub: Changing the remote URL alone is not enough. Your public key must be added to your GitHub account first.
- Ignoring expiry dates: Tokens expire. If prompts suddenly return after months of working fine, create a fresh token and save it again.
- Sharing screenshots that show a token: A visible token can be copied and abused. Revoke and replace any token that was ever exposed.
Conclusion
Git asks for your password on every push when it has no safe way to remember your login, or when the saved login is no longer accepted. Turning on a credential helper and using a personal access token fixes the problem for most HTTPS users.
If you push every day, switching your remote to SSH removes the prompts for good. Pick the method that fits your setup, test it with two pushes, and enjoy the smoother workflow.
Frequently Asked Questions
Why does Git ask for a password even after I entered it correctly?
Usually because no credential helper is enabled, so Git uses your login for that one command and then forgets it. Enable a helper for your system, and Git will save the login for future pushes.
Is a personal access token the same as my GitHub password?
No. A token is a separate, limited credential created for tools like Git. You can set its permissions and expiry date, and you can revoke it without changing your main account password.
Which is better for stopping the prompts, HTTPS with a manager or SSH?
Both work well. HTTPS with Git Credential Manager is easier for beginners, while SSH is preferred by many regular developers because keys do not expire like tokens and need no password on push.
Git still asks after I enabled the credential helper. What should I check?
Check that you used a token instead of your account password, delete any old GitHub entries from your system credential store, and confirm your setting with git config --global credential.helper.
Can I check which remote type my repository is using?
Yes. Run git remote -v. Addresses starting with https:// use HTTPS and tokens, while addresses starting with git@github.com: use SSH keys.


Leave a Reply