- 在home目录下面创建.git-credentials文件
vi .git-credentials
编辑内容
http://username:password@gitlab.com/name/project.git
- 设置记住密码(默认15分钟):
git config --global credential.helper cache
如果想自己设置时间,可以这样做:
git config credential.helper 'cache --timeout=3600'
这样就设置一个小时之后失效
长期存储密码:
git config --global credential.helper store
- 进入到~目录查看文件
$cd ~
$cat .gitconfig
会看到
[credential]
helper = store
- 进入到git项目牡蛎
cd projectfile/
- 移除远程ssh方式的仓库地址
git remote rm origin
- 增加https远程仓库地址
git remote add origin http://username:password@gitlab.com/name/project.git
git免密码 pull push
最新推荐文章于 2023-11-17 11:32:18 发布