Git错误: - all不能与refspecs结合使用

时间:2014-07-16 18:41:10

标签: git bitbucket

我在eclipse中有一个基于java的动态web项目,它放在git下用于源代码控制。 我想将这个项目上传到bitbucket的存储库中。为此,我使用了命令 下面 -

git remote add origin https://myself@bitbucket.org/myself/affablebean.git
git push -u origin --all # pushes up the repo and its refs for the first time

第二个命令给我一个错误。请告诉我为什么会这样,我该如何解决。

error: --all can't be combined with refspecs
usage: git push [<options>] [<repository> [<refspec>...]]

    -v, --verbose         be more verbose
    -q, --quiet           be more quiet.................
    -u, --set-upstream    set upstream for git pull/status
...........................

2 个答案:

答案 0 :(得分:3)

带有git push的{​​p> -u为分支设置上游,它是一个期望refspec的子命令(引用规范:分支,提交等),因此它不能与--all一起使用。

git push --all origin是正确的方法。

答案 1 :(得分:2)

简单的git push -u origin master就足够了:不需要--all

假设您已在master分支上本地添加并提交了文件。

点击“Why do I need to explicitly push a new branch?”了解更多信息。