# Git LFS(macOS Terminal) 1. 安裝homebrew、git 1. 安裝git-lfs [連結](https://git-lfs.com/) ```git brew install git-lfs ``` ![截圖 2024-03-28 下午6.54.05](https://hackmd.io/_uploads/B1A7PRMyR.png) 1. 確認有安裝成功 ```git git lfs install #顯示Git LFS initialized是安裝成功 ``` ![截圖 2024-03-28 下午6.56.53](https://hackmd.io/_uploads/By0EwCf1A.png) 1. 接著要下載github repository,將Terminal指到要放下載下來檔案的位置 ```git cd 要下載到的檔案位置(要用Finder路徑的方式) #example:cd desktop(下載到桌面) ``` 1. 下載github repository ```git git clone (HTTP連結或SSH) ``` 1. 進入下載下來的repository資料夾內 ```git cd 資料夾路徑 ``` 1. 把要加入的檔案移到資料夾內 ![截圖 2024-03-28 下午7.00.37](https://hackmd.io/_uploads/rJ_z_0MkC.png) 1. 開始設定lfs連結檔案 ```git git lfs track "*.要連結lfs的檔案副檔名" #這裡會連結所有新增檔案符合這個副檔名的檔案 #顯示Tracking是成功連接 ``` ![截圖 2024-03-28 下午7.03.04](https://hackmd.io/_uploads/rJmQ_0MJR.png) 1. 加入客製格式檔案 ```git git add .gitattributes ``` 1. 查看資料夾狀態(紅字代表還沒加入上傳佇列(還沒git add .的檔案)) ```git git status ``` 1. 接著要把檔案加入上傳佇列 ```git git add . ``` 1. 查看資料夾狀態(綠色代表等待上傳更新) ```git git status ``` 1. 新增上傳備註訊息(一定要加) ```git git commit -m "備註的上傳訊息(引號要加)" ``` 1. 推送上傳(這裡可能會需要輸入密碼,通常是Github密碼) ```git git push ``` :::warning 如果遇到輸入正確密碼還是登不進去,再開一個Terminal視窗 ```git eval "$(ssh-agent -s)" ssh-add -K 剛剛顯示輸入密碼那條的檔案路徑 #example: ssh-add -K /Users/chen/.ssh/id_ed25519 cd 到剛剛的資料夾位置 git push #成功的話就會看到他有進度條在上傳了 ``` :::