解决每次git pull需要不用输入用户名信息

问题描述

在服务器上每次执行git pull,都提示输入用户名和密码

现象分析

我们在git clone工程时有2中形式 https 和git@git。当你使用前者拉取工程时每次都需要输入用户名和密码

解决方案

1.执行下面命令

git config --global credential.helper store

这个时候~/.gitconfig文件中会多一行

[credential]
helper = store

2.执行git pull再次输入用户名和密码

此时你会看到/root/.git-credentials中会多一行内容。里面的内容类似https://{username}:{password}@github.com这种形式

发布了186 篇原创文章 · 获赞 248 · 访问量 16万+

猜你喜欢

转载自blog.csdn.net/xiaoweite1/article/details/102253028