Home  >  Q&A  >  body text

linux - 关于 git 提交到 github我怎么老是 push不上去呀

教教我

黄舟黄舟2744 days ago1164

reply all(11)I'll reply

  • 怪我咯

    怪我咯2017-04-17 16:16:43

    In addition to the method above + Baidu should be able to solve it

    reply
    0
  • 阿神

    阿神2017-04-17 16:16:43

    origin 是关键字吧 ,最好不要设置远程为origin 你可以设置为upstream 看看~~

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 16:16:43

    You try it ssh -T git@github.com 看看有没有权限
    另外 git commit 一般都写成 git commit -m "first commit"

    reply
    0
  • 天蓬老师

    天蓬老师2017-04-17 16:16:43

    As mentioned above, you did not use -m to specify the commit message when committing, causing the commit to fail.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 16:16:43

    Doesn’t the remote branch already exist? First set-upstream, then pull and push

    reply
    0
  • 巴扎黑

    巴扎黑2017-04-17 16:16:43

    When you executed git commit test.txt, it failed (note that there are three words "stopped" at the bottom). The reason is that git forces the commit operation to have comments (svn is not mandatory), and you did not add comments. You have to execute "git commit -m "Write a comment here, it can be in Chinese"" before you can submit normally. Then "git remote add origin git@github.com/xxxx/xxx.git". Finally "git push origin master" will do the trick.

    reply
    0
  • PHPz

    PHPz2017-04-17 16:16:43

    Usually use commit -m "modify version information", and then use git add remote origin + information.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 16:16:43

    There is nothing in the local library
    `git status
    git add .
    git commit -m "update" `
    Then push.

    reply
    0
  • ringa_lee

    ringa_lee2017-04-17 16:16:43

    Transfer your public key to github first

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 16:16:43

    First, pay attention to the running results of the command. After the previous command runs successfully, run the following command again. The author started to get errors from the third git command, git commit都没有成功,后续的push命令当然也会报错。另外,由于楼主的仓库貌似默认已经有远程仓库(origin)了,因此再通过git remote add origin ...设置远程仓库当然会产生冲突。你可以换一个远程仓库的别名,例如楼上说的upstream,或者你可以通过git remote set-url origin <your remote repository url> came to reset the origin URL.
    It can be seen from your operation that you should be a beginner. It is recommended that you understand the basic commands of git first, and then come to the forum to ask questions when you encounter complex problems. By the way, the book Progit is a good choice for learning git. There is a free electronic version on the official website.
    In addition, I think if you can use text explanation + code or error log when asking a question, try not to post pictures directly, as this will not be convenient for others to search online.

    reply
    0
  • Cancelreply