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)