ubuntu16.04上傳code到Github步驟
step 1.創建ssh-key
~$ssh-keygen -t rsa -C "[email protected]"
step 2.將上步生成的~/.ssh/id_rsa.pub 文件複製到github的ssh keys上
step 3.添加你的新的密鑰到 ssh-agent(ssh 代理)
~$ssh-agent -s
~$ssh-add ~/.ssh/id_rsa
*注: 如果執行 ssh-add 時顯示錯誤 Could not open a connection to your authentication agent. 那麼執行
~$eval `ssh-agent -s`
~$ssh-add ~/.ssh/id_rsa
正常會出現提示:Identity added: /home/vitamin/.ssh/id_rsa (/home/vitamin/.ssh/id_rsa)
Step 4: Add your SSH key to GitHub 添加 SSH 密鑰到 Github
使用您最喜愛的文本編輯器,你可以手動打開公共密鑰文件和複製文件的內容。
現在,你有鑰匙的拷貝,是時候添加到GitHub。
step 5:使用以下命令登陸自己的GitHub賬號:
git config --global user.email "[email protected]"
git config --global user.name "Your Name"
step 6:git clone github創建的庫
git clone git@github.com:xx-github/test.git
用Clone with SSH
Use an SSH key and passphrase from account.
step 7: 在本地test庫下編輯需要上傳的文件,用以下命令上傳
git add -A #添加所有的文件
git commit -m "註釋語句" //註釋語句是提示上傳的是內容,版本號
git push origin master
參考鏈接
Ubuntu環境如何上傳項目到GitHub網站?
(診斷)爲GitHub添加SSH key時出現“Could not open a connection to your authentication agent”錯誤的應對方案
ubuntu 16.04 將本地項目上傳到github
Generating SSH keys 生成 SSH 密鑰
Error: Permission denied (publickey)