Git push requires username and password

前端 未结 24 2040
灰色年华
灰色年华 2020-11-22 04:14

I cloned a Git repository from my GitHub account to my PC.

I want to work with both my PC and laptop, but with one GitHub account.

When I try to push to or p

24条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 04:38

    Permanently authenticating with Git repositories

    Run the following command to enable credential caching:

    $ git config credential.helper store
    $ git push https://github.com/owner/repo.git
    
    Username for 'https://github.com': 
    Password for 'https://USERNAME@github.com': 
    

    You should also specify caching expire,

    git config --global credential.helper 'cache --timeout 7200'
    

    After enabling credential caching, it will be cached for 7200 seconds (2 hour).

提交回复
热议问题