git免密码 pull push

  1. 在home目录下面创建.git-credentials文件
    vi .git-credentials

    编辑内容
    http://username:[email protected]/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. 进入到~目录查看文件
    $cd ~
    $cat .gitconfig

    会看到
    [credential]
    helper = store
  4. 进入到git项目牡蛎
    cd projectfile/
  5. 移除远程ssh方式的仓库地址
    git remote rm origin
  6. 增加https远程仓库地址
    git remote add origin http://username:[email protected]/name/project.git
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章