Skip to main content

Why is Git always asking for my password?

If Git prompts you for a username and password 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.

当 Git 提示你输入密码时,请输入你的personal access token。 或者,可以使用 Git 凭据管理器等凭据帮助程序。 Git 的基于密码的身份验证已被删除,取而代之的是更安全的身份验证方法。 有关详细信息,请参阅“管理个人访问令牌”。

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.

Further reading