Git Bash提交代码避免每次输入用户密码

使用Git提交代码遇到每次都需要输入用户名密码的情况,只要在本地生成一个认证文件即可免去输入。在%HOME%目录,一般是C:\users\Administrator。使用git bash命令:

$touch .git-credentials

$vim .git-credentials

// 然后输入

https://{username}:{password}@github.com

然后移动到项目目录下面使用:

$git config --global credential.helper store

再次pull一次代码,可能会让你再输入一次账号密码,不过这次是最后一次,以后就不需要了。
之后再提交代码即可免去输入用户名密码。

猜你喜欢

转载自blog.csdn.net/qq_38483094/article/details/103239791