在终端输入 git config --global credential.helper store 可以看到~/.gitconfig文件,会多了一项: [credential] helper = store 之后git push时输入一次密码,默认就会把用户名和密码记录在主目录下的.git-credentials里,以后就不用再输入了。