在linux下每次使用git都需要输入密码,下面二种方法可以解决每次linux下git输入密码.
一、通过文件方式
1.在~/下,touch创建文件.git-credentials,用vim编辑此文件,输入内容格式:
touch.git-credentials
vim.git-credentials
在里面按“i”然后输入:https://{username}:[email protected]
比如https://account:[email protected]
2.在终端下执行
gitconfig--globalcredential.helperstore
3.可以看到~/.gitconfig文件,会多了一项:
[credential]
helper=store
4.OK
二、通过缓存方式
要求:git版本需要>=1.7.10
gitconfig--globalcredential.helpercache
#默认缓存密码15分钟,可以改得更长,比如1小时
gitconfig--globalcredential.helper'cache--timeout=3600'
gitpullhttp:[email protected]:8080/zhima/test.gitmaster
|