在github上建了一个项目,本地也有代码,本地用git init初始化了一下,请问然后怎么将本地的代码提交到github上呢?
1 本地生成ssh-key: ssh-keygen -t rsa -C "$userEmail"
2 github帐号上粘贴公钥
3 本地添加远程库: git remote add origin git@xxxxx.git
4 测试是否成功-->commit一个文件,然后push,看github上是否有
5 以后在此电脑上连接别的github库时,1,2步骤省略
1 本地生成秘要 : $ ssh-keygen -t rsa -C "youremail@example.com"
2 然后cd .ssh 进入文件夹 vim id_rsa.pub 将秘要粘贴到github 中(位于“Account settings”,“SSH Keys”页面)
3 关联本地与远程长裤(注意修改地址):$ git remote add origin git@github.com:michaelliao/learngit.git
4 $ git push -u origin master
5 以后推送直接使用命令 :$ git push origin master
2 回答1.2k 阅读✓ 已解决
2 回答838 阅读✓ 已解决
1 回答650 阅读✓ 已解决
1 回答810 阅读
1 回答623 阅读
192 阅读
请看 帮助 https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/