search

Home  >  Q&A  >  body text

github - git push -u origin 总是报错

使用的是最新版本的git,push到远程总是报错。我所有的额执行代码如下:

git init
git add .
git commit -a -m "first commit"
git remote add origin git@github.com:zbphp/zbphp.com.git
git push -u origin

结果报错,然后有的时候会提交到远程,有的时候又无法提交到远程,很奇怪

补充

我之后运行了

git config --global push.default origin
git config --global push.default #输出origin

#然后我再提交,结果报错了,连提交都不能了
git push 
git push -u origin #也报错了

另外,bash里面是如何复制啊。

现在这样了

滿天的星座滿天的星座2798 days ago691

reply all(2)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-25 09:06:16

    Look at the prompt, isn’t it asking you to run it?....git config --global push.defaulthttp://www.oschina.net/news/45585/git-2-x-change-push-default-to-simple


    Look what you have run, please run it

    git config --global push.default simple
    


    Follow the prompts, why can’t you add the branch name when pushing...囧...

    reply
    0
  • 为情所困

    为情所困2017-04-25 09:06:16

    1. It means that you did not specify which branch you want to commit to. git push 远程仓库 远程仓库所在分支 而你,只写了git push origin。 没有说明分支信息。 比如git push origin masterThat’s it.
    2. Right click-->Edit-->Select and then copy. Don't complain, this is a DOS approach, git for win is based on DOS.

    reply
    0
  • Cancelreply