我已按照以下说明上传项目。
全局设置:
Download and install Git git config --global user.name "Your Name" git config --global user.email tirenga@gmail.com Add your public key Next steps: mkdir tirengarfio cd tirengarfio git init touch README git add README git commit -m 'first commit' git remote add origin git@github.com:tirenga/tirenga.git git push origin master
但我得到这个错误:
权限被拒绝(公钥)。致命:远端意外挂断
对我来说,问题是通过 sudo 执行克隆。
如果您克隆到您拥有用户权限的目录(/home/user/git),它将正常工作。
(说明:以超级用户身份运行命令将无法使用与以用户身份运行命令相同的公钥。因此 Github 拒绝了连接。)
此解决方案需要已设置 SSH 密钥:https ://help.github.com/articles/generating-ssh- keys