linux下每次git clone不需输入账号密码的方法

       有的仓库有很多的子模块 submodule 当clone的时候每个子模块都会让输入一次账户密码,不胜其烦,解决方法如下:

在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:

touch .git-credentials
vim .git-credentials

在里面按“i”然后输入:https://{username}:{password}@github.com

比如 https://aoeddklj:[email protected]

在终端下执行:

git config --global credential.helper store

可以看到~/.gitconfig文件,会多了一项:

[credential]
    helper = store

这个时再次拉取子模块时只需输入一次即可。

猜你喜欢

转载自blog.csdn.net/qq_34761779/article/details/130251362