GitHub 於 Linux 的環境設定

GitHub 有 300M 的免費空間可以使用, 在此將從 GitHub 與 Linux 環境設定, 做個紀錄.


下述為 GitHub 於 Linux 的環境設定 與 簡易操作步驟:

參考此文件: Help.GitHub - Set Up Git (Linux)

為 GitHub 產生一組 Key

  • ssh-keygen -t rsa -C "[email protected]"

    Generating public/private rsa key pair.
    Enter file in which to save the key (/home/user/.ssh/id_rsa): id_rsa_github
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:
    Your identification has been saved in id_rsa_github.
    Your public key has been saved in id_rsa_github.pub.
    The key fingerprint is:...

將 Key 設定到 GitHub 裡面

  1. 登入 GitHub
  2. Account Settings -> SSH Public Keys -> Add another public key
  3. cat id_rsa_github.pub # 貼上這全部內容

設定專給 GitHub 的 key

  1. vim .ssh/config

    Host github
    HostName github.com
    User git
    Port 22
    identityfile ~/.ssh/id_rsa_github

  2. ssh github # 測試

    Warning: Permanently added 'github.com,207.97.227.239' (RSA) to the list of known hosts.
    PTY allocation request failed on channel 0
    Hi tsung! You've successfully authenticated, but GitHub does not provide shell access.
    Connection to github.com closed.

設定自己的 Git 環境

  1. git config --global user.name "Firstname Lastname"
  2. git config --global user.email "[email protected]"

取得 GitHub API Token 與 設定

  1. 登入 Github
  2. Account Settings -> Account Admin -> 取得 API token (0123456789yourf0123456789token)
  3. git config --global github.user username
  4. git config --global github.token 0123456789yourf0123456789token
  5. 到此即設定完成.

作者: Tsung

對新奇的事物都很有興趣, 喜歡簡單的東西, 過簡單的生活.

在〈GitHub 於 Linux 的環境設定〉中有 2 則留言

    1. 如果有照我上面設定的話,你應該用的是這樣 ssh github
      Checkout : git clone github/xxx.git
      (Github 會自動等同 github => ssh 裡面有設定)

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料