Git: Any way to set default login credentials?

前端 未结 5 1267
情书的邮戳
情书的邮戳 2021-02-05 23:16

I\'m using terminal for mac and running the line

git push origin master

It asks me for my github.com username and password every time,
is t

5条回答
  •  深忆病人
    2021-02-05 23:33

    Using an empty passphrase is considered bad practice. Quoting Help.Github:

    Passwords aren’t very secure, you already know this. If you use one that’s easy to remember, it’s easier to guess or brute-force. If you use one that’s random it’s hard to remember, and thus you’re more inclined to write the password down. Both of these are Very Bad Things™. This is why you’re using ssh keys.

    But using a key without a passphrase is basically the same as writing down that random password in a file on your computer. Anyone who gains access to your drive has gained access to every system you use that key with. This is also a Very Bad Thing™. The solution is obvious: add a passphrase.

    The right solution here is to use ssh-agent - this way, Git will ask for your password only once per session. See this page for pointers on how to set it up on your system.

提交回复
热议问题