Git 常用基本指令

  • 170099
  • 0
  • Git
  • 2020-06-15

//從遠端同步檔案下來本機
$ git clone git@11.22.333.123:xxxxxxx.git

//進入資料夾
$ cd xxxx/

//回上一層目錄
cd ..

//回上次工作目錄
cd -

...繼續閱讀 »

Git 回到之前的Commit提交紀錄

返回前提交紀錄有兩種模式 Hard 與 Soft

Hard 

$ git reset --hard HEAD :

此種模式完全不保留原始 commit 結點的任何資訊,會連同資料夾中實體檔案內容都進行重置,也就是直接將工作區、暫緩區及 git 目錄都重置成目標Reset結點的資料內容。

Soft 

$ git reset --soft HEAD / commit id :此模式下會保留工作區資料內容不會異動到目前所有的實體檔案內容;也會保留暫緩區資料內容,讓暫緩區與 git 目錄資料內容是一致的。

...繼續閱讀 »

Git 解決「remote: Repository not found.」錯誤

錯誤訊息:

remote: Repository not found.
fatal: repository 'https://github.com/xxx/xxx.git/' not found

如果確認git位置沒有問題,但執行pull/push還是失敗並出現此錯誤訊息

表示你當前remote的repository權限,跟你要pull/push的git位置權限不一致

...繼續閱讀 »

Git 解決「remote: Invalid username or password.」錯誤

  • 6536
  • 0
  • Git
  • 2020-06-15

錯誤訊息:

remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/xxxxxxxx.git/'

如果你帳密都對,但出現此錯誤,

請檢查一下,你的帳戶安全設定,是不是設有二次驗證(Two-factor authentication)

導致你的git要去存取時被擋住了~

...繼續閱讀 »