首页 > 系统服务 > 详细

linux 保存git的账号密码

时间:2018-05-07 13:08:23      阅读:181      评论:0      收藏:0      [点我收藏+]

今天在弄jenkins一建发版,遇到了git下载每次都要输入账号密码,所以百度一下,使用一下方法,搞定

一、通过文件方式

1.在~/下, touch创建文件 .git-credentials, 用vim编辑此文件,输入内容格式:

touch .git-credentials
vim .git-credentials

在里面按“i”然后输入: https://{username}:{password}@github.com 

比如 https://account:password@github.com

2. 在终端下执行

git config --global credential.helper store

3. 可以看到~/.gitconfig文件,会多了一项:

[credential]
helper = store

4.OK

 

二、通过缓存方式

要求:git版本需要>=1.7.10

git config --global credential.helper cache
# 默认缓存密码15分钟,可以改得更长, 比如1小时
git config --global credential.helper cache --timeout=3600

linux 保存git的账号密码

原文:https://www.cnblogs.com/houchaoying/p/9002007.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!