# Git安裝、GitHub設定同步與GitGraph的使用 ###### tags: `github` `git` `vscode` `eclipse` `tutorials` ### step 1 打開[GitHub](https://github.com/) https://github.com/ 先註冊GitHub帳號 然後我們要建立一個Repository(大概可以翻譯成'儲存庫'的意思),如下圖  <br/> 點進New之後會看到 <br/>  <br/> **Repository Name是指你的儲存庫的名稱** **Description是指你對此儲存庫的描述,可寫可不寫** **Public是你要公開這個儲存庫,所有人透過網路可以看到妳儲存庫的內容物** **Private就是不公開,只有你看的到** **最後按Create Repository** **你在GitHub上的儲存庫就建好了** -- :::warning 💡建立好Repository的畫面會像這樣,請留著這個頁面,等一下我們需要用到紅框中的這串文字 :::  --- ### step 2 確認要同步的資料夾的位置 我的路徑如下 D:\1_iSpan\Java\JavaWorkspace\Test\test Test是我在本機硬碟內建立的資料夾 test是GitHub上Repository的名字 最好是GitHub上的名字要清楚且意義,就可以省去還要再在本機建一個資料夾(例如上方的test)的步驟。 舉例來說:我GitHub上有iSpan_Project1這個Repository 所以其實我可以直接在D槽操作,clone這個Repository 那檔案路徑就會是D:\iSpan_Project1 清楚! 明瞭! 詳細步驟,請參考下方說明~ --- ### step 3 下載[git](https://git-scm.com/download/win) https://git-scm.com/download/win  <br/> **安裝好Git後,開啟 Git CMD**  <br/> 輸入以下的指令 :::info * cd /d 空一格後,**++貼上你要同步的資料夾位置++** * cd /d 是window系統的語法 * mac與linux系統請使用cd 空一格後再貼上資料夾位置 * 且mac與linux系統的路徑斜線方向是/,而window的路徑則是反斜線\ * git clone 空一格後,**++貼上剛剛在GitHub上,建好Repository後顯示的那串url++** * cd 空一格後,切換路徑至Repository資料夾 * git config user.name空一格後,**++寫上名字++** * git config user.email空一格後,**++寫上email++** * user.name和user.email只是用來辨識用,不一定要跟註冊GitHub時一樣 ::: 我的指令如下 供參供複製~ ```javascript cd /d d:\1_iSpan\Java\JavaWorkspace\Test git clone https://github.com/KikiJin24/test.git cd test //此處使用相對路徑來切換位置 git config user.name KikiJin git config user.email jin991824@gmail.com ```  <br/> <br/> ### step 4 開啟 VS Code, 打開左側選單中的Extention,搜尋並下載Git Graph * Git Graph <!-- * GitLens --> <!-- * Git History -->  <br/> <br/> ### step 5 VS Code 設定 auto guess encoding  使VScode即時猜測編碼,確保當我忘記檢查就push時,檔案編碼仍然是正確的 <br/> <br/> ### step 6 重開 VS Code <br/> ### step 7 用 VS Code 開啟clone下來的GitHub Repository Files --> Open Folder --> 選擇剛剛同步的資料夾,也就是我的test資料夾 <br/> ### 完成同步設定!! <!-- 接下來就可以直接在VScode上操作囉~VScode的操作請參考我的另一份教學 --> <br/> --- ### 補充 #### Git Graph的作用 可以清楚看到檔案路徑,也能確定自已現在是不是有檔案待push或待pull :+1:  --- ### 相關文章連結: * [.gitignore教學,搞定GitHub同步,不再報錯!停止上傳奇怪的環境檔與編譯檔](https://hackmd.io/@KikiJin24/tutorial_gitignore) * [Maven教學,10分鐘學會讓你同步jar檔更輕鬆的Maven專案](https://hackmd.io/@KikiJin24/tutorial_maven)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up