解决每次git pull需要输入用户名密码的问题

问题描述

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

现象分析

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

解决方案

1.执行下面命令

git config --global credential.helper store


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

[credential]
helper = store

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

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



 

 
posted @ 2020-05-09 09:51  独孤败天大神  阅读(2208)  评论(0编辑  收藏  举报