sudo apt-get install git
$ git config --global user.name "Your Name" $ git config --global user.email Your_email@example.com
git init
sudo apt-get install ssh
首先 ssh-keygen 會確認密鑰的存儲位置和文件名(默認是 .ssh/id_rsa),而後他會要求你輸入兩次密鑰口令,留空便可。因此通常選用默認,所有回車便可。git
ssh-keygen -t rsa -C "你的github帳號郵箱"
默認密鑰文件路徑在~/.ssh
,id_rsa
是私鑰文件,id_rsa.pub
是公鑰文件github
id_rsa.pub
文件內容所有複製ssh -T git@github.com
若是結果爲 「 ...You've successfully authenticated, but GitHub does not provide shell access」,則說明成功。shell
git remote add origin git@github.com:Username/Repositories_Name.git
若是手誤輸錯,可經過git remote remove origin
命令刪除該遠程倉庫。ssh
git add xxx
git commit -m "xxxxxx"
git push origin master
OK!ide