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

后端 未结 24 3337
囚心锁ツ
囚心锁ツ 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条回答
  •  -上瘾入骨i
    2020-11-21 05:22

    If you are using osxkeychain and had a token expire and want to update it, follow these steps:

    Run in terminal, then press enter twice.

    git credential-osxkeychain erase
     host=github.com
     protocol=https
    

    Now you should be prompted for a username/password. However sometimes it seems this does not 'take' and you have to keep re-entering.

    If so, restart your computer. Now the next time you run a git command and enter your username/password, it will be saved.

提交回复
热议问题