Ubuntu 上安裝 git 並抓取程式碼 Install git on Ubuntu and Obtain the codes === 安裝指令 Install git ``` sudo apt-get install git ``` 建立目錄 Create a new directory called repo ``` mkdir repo cd repo ``` 初始化目錄(產生 .git 檔案) Initialization ``` git init ``` 設定使用者名稱 Set git user name (You should register the user name on git first) ``` git config user.email "sam.liaw@creativearktech.com" git config user.name "sam.liaw" #上面目錄內設定一次就可以了,另一種設定 global 使用者名稱,但還沒測試過是否跨目錄 git config --global user.name "sam.liaw" git config --global user.email "sam.liaw@creativearktech.com" ``` 查看剛剛的設定是否正確 Check the configuration ``` git config --list ``` 取得程式碼,按下執行會要求輸入密碼,是一個 git 很長的 token 不是登入密碼 最後的 tlde 是指抓取程式碼到現在目錄下的 tlde 目錄,沒有會新建 tlde 目錄 When retrieving the code, you will be asked a git token which is a long text. ``` git clone https://creativeark@dev.azure.com/creativeark/Design%20Engine/_git/TLDE.Service tlde ``` 如果設定錯誤,可以用下列指令刪除所有程式碼 If something is wrong, you can delete all of the retrived code by the following command. ``` sudo rm -r -f /path/ ``` ## 參考筆記 [Ubuntu 上強制 git pull 覆蓋本地檔案(儲存密碼)](https://hackmd.io/@sam-liaw/HJEr-NElL) ###### tags: `git` `Ubuntu` `工作紀錄`