解决git命令行每次都要输入账号密码

Windows 上设置避免每次 git push 都需要账号密码

在 C:\Users\your name\ 目录下找到到 .gitconfig 这个文件,使用编辑器打开

[user]
    name = ****
    email = ********.com
[credential]
    helper = store

文件中增加 [credential]配置

[credential]
    helper = store

配置完成保存退出,在项目文件夹打开git bash,使用git pull再输入一次账号密码。最后一次使用git pull

$ git pull
Already up to date.

ok.

linux 上设置避免每次 git push 都需要账号密码

cd /进入根目录,执行以下命令

git config --global credential.helper store

上述命令目的与windows环境中直接编辑.gitconfig目的相同。

进入项目目录,执行git pull,按windows环境操作完成账号密码的录入即可。

猜你喜欢

转载自www.cnblogs.com/xzdm/p/12964532.html