'git push' always needs password and username

Posted quinn-yann

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了'git push' always needs password and username相关的知识,希望对你有一定的参考价值。

Refer to :

https://help.github.com/articles/caching-your-github-password-in-git/

https://help.github.com/articles/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: 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.

 

Caching your GitHub password in Git

Turn on the credential helper so that Git will save your password in memory for some time. By default, Git will cache your password for 15 minutes.

  1. In Terminal, enter the following:

    git config --global credential.helper cache
    # Set git to use the credential memory cache
    
  2. To change the default password cache timeout, enter the following:

    git config --global credential.helper ‘cache --timeout=3600‘
    # Set the cache to timeout after 1 hour (setting is in seconds)
    

以上是关于'git push' always needs password and username的主要内容,如果未能解决你的问题,请参考以下文章

'git push origin master'中'origin'是什么意思

git常见错误:error: failed to push some refs to 'xxx'

git报错failed to push some refs to 'git@github.com:Markprint/github.git'

git push报错error: failed to push some refs to 'git@github.com:

Git错误:error:failed to push some refs to 'git@gitee.com:name/project.git'

git push 之 Enter passphrase for key '/Users/MYNAME/.ssh/id_rsa'