Is there a way to cache GitHub credentials for pushing commits?

后端 未结 24 3279
囚心锁ツ
囚心锁ツ 2020-11-21 05:02

I recently switched to synchronizing my repositories to https:// on GitHub (due to firewall issues), and it asks for a password every time.

Is there a way to cache t

24条回答
  •  遥遥无期
    2020-11-21 05:09

    You can also have Git store your credentials permanently using the following:

    git config credential.helper store
    

    Note: While this is convenient, Git will store your credentials in clear text in a local file (.git-credentials) under your project directory (see below for the "home" directory). If you don't like this, delete this file and switch to using the cache option.

    If you want Git to resume to asking you for credentials every time it needs to connect to the remote repository, you can run this command:

    git config --unset credential.helper
    

    To store the passwords in .git-credentials in your %HOME% directory as opposed to the project directory: use the --global flag

    git config --global credential.helper store
    

提交回复
热议问题