git免密码 pull push

  1. 在home目录下面创建.git-credentials文件
    1
    vi .git-credentials
    编辑内容
    1
    http://username:password@gitlab.com/name/project.git
  2. 设置记住密码(默认15分钟):

git config --global credential.helper cache
如果想自己设置时间,可以这样做:
git config credential.helper 'cache --timeout=3600'
这样就设置一个小时之后失效
长期存储密码:
git config --global credential.helper store
3. 进入到~目录查看文件

1
2
$cd ~
$cat .gitconfig

会看到
1
2
[credential]
helper = store

4. 进入到git项目

1
cd projectfile/
  1. 移除远程ssh方式的仓库地址

    1
    git remote rm origin
  2. 增加https远程仓库地址

    1
    git remote add origin http://username:password@gitlab.com/name/project.git

git免密码 pull push
https://www.wekri.com/workflow/git免密码-pull-push/
Author
Echo
Posted on
November 1, 2016
Licensed under