Git: Any way to set default login credentials?

前端 未结 5 1275
情书的邮戳
情书的邮戳 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:43

    If on OSX, you should be able to use the osxkeychain helper. You can check to see if you already have it installed by typing:

    git credential-osxkeychain
    

    If you get a message saying that's not a valid git command, you can install it by doing:

    curl -s -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
    chmod u+x git-credential-osxkeychain
    sudo mv git-credential-osxkeychain `dirname \`which git\``
    

    Then tell git to use it with:

    git config --global credential.helper osxkeychain
    

    You will be asked to provide your credentials once more the next time you do a pull/push. From then on, git should remember your info.

提交回复
热议问题