Try   HackMD

Git 基礎課程 行前提醒

軟體安裝

VS Code

  1. 依據筆電作業系統到 VS Code官網 選擇對應的版本安裝
  2. 下載後開啟 VS Code 並點選左側欄的 Extensions 按鈕
  3. 搜尋 Git Graph 套件並按下 Install
  4. 安裝成功後左側欄會多出一個按鈕

Git

  1. 依據作業系統在 Git官網 下載對應版本

  2. 在 VS Code 打開終端機,輸入 git --version 檢查是否安裝成功

初次使用設定

GitHub 帳號註冊

  • GitHub 註冊帳號並登入

設定個人資料

  • 在終端機上進行個人資料的設定
    • 輸入姓名:git config --global user.name "xxxxxx"
    • 輸入個人的 email:git config --global user.email "xxxxxx"
    • 查詢 git 設定內容:git config --list ,查詢結束輸入q即可離開

設定 ssh 連接

  1. 在終端機上輸入 ssh-keygen
  2. 不須輸入任何文字按 Enter 鍵直到出現類似下列的畫面
    ​​​​Generating public/private rsa key pair.
    ​​​​Enter file in which to save the key (/Users/niomoo/.ssh/id_rsa): <輸入 Enter 鍵>
    ​​​​Created directory '/Users/niomoo/.ssh'.
    ​​​​Enter passphrase (empty for no passphrase): <輸入驗證密碼>
    ​​​​Enter same passphrase again: <再輸入一次同樣的驗證密碼>
    ​​​​Your identification has been saved in /Users/niomoo/.ssh/id_rsa.
    ​​​​Your public key has been saved in /Users/iniomoo/.ssh/id_rsa.pub.
    ​​​​The key fingerprint is:
    ​​​​57:15:3c:ca:f2:dc:27:6d:c2:9a:88:d0:70:cf:8d:31 niomoo@niomooMBP.local
    ​​​​The key's randomart image is:
    ​​​​+--[ RSA 2048]----+
    ​​​​|             .o. |
    ​​​​|             .o  |
    ​​​​|           ... . |
    ​​​​|      . . E.o    |
    ​​​​|       +So.O o . |
    ​​​​|      . ..+ + = +|
    ​​​​|       . . . o = |
    ​​​​|        . . o    |
    ​​​​|                 |
    ​​​​+-----------------+
    
  3. 繼續在終端機上輸入指令 cat ~/.ssh/id_rsa.pub
  4. 將終端機上出現的 ssh-rsa 開頭整串文字複製起來
  5. 進入 GitHub 的設定頁面
  6. 找到左側的 SSH and GPG keys 頁面並點選 New SSH key
  7. Title 輸入你想要的名稱(建議以電腦命名),並在 Key 中貼上剛剛複製下來的公鑰
  8. 按下 Add SSH key 就完成了!