Skip to main content

Why is Git always asking for my credentials?

If Git prompts you for your credentials every time you try to interact with GitHub, you're probably using the HTTPS clone URL for your repository.

Using an HTTPS remote URL has some advantages compared with using SSH. It's easier to set up than SSH, and usually works through strict firewalls and proxies. However, it also prompts you to enter your GitHub credentials every time you pull or push a repository.

When Git prompts you for your password, enter your personal access token. Alternatively, you can use a credential helper like Git Credential Manager. Password-based authentication for Git has been removed in favor of more secure authentication methods. For more information, see Managing your personal access tokens.

You can avoid being prompted for your password by configuring Git to cache your credentials for you. Once you've configured credential caching, Git automatically uses your cached personal access token when you pull or push a repository using HTTPS.

If you are an Enterprise Managed User, and your enterprise owners do not have the SSO Redirect setting enabled for the enterprise, then credential caching may not work properly when using Git Credential Manager (GCM). You will need to disable GCM account filtering locally in this situation to prevent getting prompted for authentication each time you perform a Git operation. For more details, see Caching your GitHub credentials in Git.

Further reading