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
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章