将 Git 的 credential 证书保留在系统,可以避免每次操作都需要输入账户密码。

各系统中设置缓存参考我的文章:https://niekun.net/index.php/archives/444.html

对于 Windows 10 用户,系统内置了 Windows subsystem for Linux (WSL),我们可以共享存储在本地的 Git credential 证书,这样两个系统使用 git 都很方便。

关于 WSL 的安装与使用参考:https://niekun.net/index.php/archives/1148.html

首先在 Windows 10 下设置 credentials,在 power shell 下输入如下命令:

git config --global credential.helper wincred
可以在仓库内测试执行 git push 命令,如果提示输入账户密码,则输入一次,以后就不会再提示了。

然后在 WSL 设置,打开系统内安装好的 WSL,首先安装好 git,然后敲入如下命令:

git config --global credential.helper "/mnt/c/Program\ Files/Git/mingw64/libexec/git-core/git-credential-wincred.exe"

标签:git, wsl, share

你的评论