Linux下git 命令 免输密码设置

2021-11-05  本文已影响0人  海阔天空的博客

. 在~/目录下, touch创建文件 .Git-credentials

cd ~
touch .git-credentials
vim .git-credentials

点击 “i” 进入编辑文件模式

https://{username}:{password}@github.com
例如 
https://zhang3:12345@github.com

点击“ESC” 然后输入“:wq”退出编辑并保存

  1. 在终端下执行
git config --global credential.helper store
  1. 可以看到~/.gitconfig文件,会多了一项:
vi .gitconfig 

可以看到

[credential]
    helper = store
  1. 再次执行 git命令
    只需要输入1次 正确的账号和密码 以后可以直接跳过输入账号密码了
上一篇下一篇

猜你喜欢

热点阅读