- 在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
最新推荐文章于 2024-08-23 09:52:27 发布
本文介绍如何在Git中配置凭据缓存及长期存储,包括创建.git-credentials文件、设置凭据助手以缓存密码并指定缓存过期时间,以及如何移除和添加远程仓库地址。
4867

被折叠的 条评论
为什么被折叠?



