# GitHub ![image](https://hackmd.io/_uploads/Byeba8t22p.png) ## 介紹 GitHub是一個基於Git版本控制系統的程式碼託管平台。它提供了一個集中的地方讓開發者存儲、管理和分享他們的程式碼專案。GitHub讓使用者能夠建立自己的程式碼庫(repository),在庫中進行程式碼的版本控制、協作開發和問題追蹤。除了程式碼,GitHub也支援其他種類的文件,如說明文件。它還提供了強大的協作功能,例如合併請求(Pull Request)、問題追蹤(Issue Tracking)等,使得多人協作程式開發變得更加輕鬆和高效。GitHub已成為開源社群和許多企業的首選平台之一,被廣泛應用於軟體開發和協作領域。 ## GitHub Classroom 加入 1. 加入 GitHub Classroom [請點擊此文字已加入GitHub Classroom](https://classroom.github.com/a/Zye_d4Kx) 2. 選擇自己的名稱 ![image](https://hackmd.io/_uploads/HJAa8Fn2a.png) 3. 示範 ![image](https://hackmd.io/_uploads/r1cRUth36.png) 4. 點擊網址恭喜完成 ![image](https://hackmd.io/_uploads/HJZ-DK33a.png) 5. 屬於自己的儲存庫repository ![image](https://hackmd.io/_uploads/Hk5ewK3np.png) ## 將寫好的專案上傳到 GitHub 上 1. 打開寫好的一個專案 ![image](https://hackmd.io/_uploads/S1SGPF22T.png) 2. 對右邊的方案 "名稱" 點選右鍵 ![image](https://hackmd.io/_uploads/SJiGDYnnT.png) 3. 選擇複製完整路徑 ![image](https://hackmd.io/_uploads/HJb7PY2hT.png) 4. 打開終端機(搜尋 cmd) ![image](https://hackmd.io/_uploads/B1OXvthnT.png) 5. 在推送前我們需要先告訴電腦我們的 GitHub 的帳號密碼 因此請先輸入 >git config \-\-global user.name "你的 GitHub 名稱" >git config \-\-global user.email "你的email@gmail.com" ![image](https://hackmd.io/_uploads/SkZNDFn2a.png) 6. 輸入 cd + "複製的路徑" -> 會發現無效 ![image](https://hackmd.io/_uploads/rk_8DKh26.png) 7. 輸入 cd + "複製的路徑" -> 這邊將MyFirstProject.sln刪除掉 ![image](https://hackmd.io/_uploads/rkZPPY2hT.png) 8. 輸入 git init ![image](https://hackmd.io/_uploads/H13DPK326.png) 9. 輸入 git remote add origin "GitHub 上的 URL" ![image](https://hackmd.io/_uploads/SkQdvFh2T.png) 10. 輸入 git pull "GitHub 上的 URL" ![image](https://hackmd.io/_uploads/BkROPt22T.png) 11. 輸入 git add . ![image](https://hackmd.io/_uploads/BJHKvYnna.png) 12. 輸入 git commit -m "First_Commit" ![image](https://hackmd.io/_uploads/HknKDK2n6.png) 13. 輸入 git push -u origin master ![image](https://hackmd.io/_uploads/Syf-GuTn6.png) 14. 查看repository,大功告成 ![image](https://hackmd.io/_uploads/S1wqwKh2T.png) ## Git 指令在幹嘛的? 操作完後,稍微理解這些指令在做甚麼的 - git init - 在目前工作區 (Workspace) 內建立一個 .git folder - git remote - 連線到遠端伺服器 - git pull - 將遠端儲存庫的內容拉取到本地 - git add - 對檔案建立索引 - git commit - 將建立索引的檔案提交至本地資料庫 (Local Repository) - git push - 上傳至 Git 目錄