Ubuntu 上強制 git pull 覆蓋本地檔案(儲存密碼)
===
```
git fetch --all
git reset --hard origin/dev
git pull
```

需要 MSDN 的帳號 `sam.liaw@creativearktech.com` 上面專門給簽入用的 token
如果 token 正確並懶得每次輸入密碼,可以輸入下面指令,來減少一直輸入密碼的狀況
```
git config --global credential.helper store
```
上面是永久儲存密碼,之後就不用輸入了
如果怕安全有疑慮,可以輸入下面指令
```
git config --global credential.helper cache
```
這個可以15分鐘內 cache,不需要輸入密碼
想調整 cache 時間可以輸入下面的指令
```
git config credential.helper 'cache --timeout=3600'
```
## 參考資料
[git 设置不需要输入密码, 去除 fetch / pull 代码每次都需要输入密码的烦恼](https://blog.csdn.net/e62ces0iem/article/details/73550869)
## 參考筆記
[Ubuntu 上安裝 git 並抓取程式碼](https://hackmd.io/@sam-liaw/BkzQ9zC0B)
###### tags: `git` `Ubuntu` `工作紀錄`