Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git错误:--所有can';不能与参考规范结合使用_Git_Bitbucket - Fatal编程技术网

Git错误:--所有can';不能与参考规范结合使用

Git错误:--所有can';不能与参考规范结合使用,git,bitbucket,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 第二个命令给了我一个错误。

我在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
...........................
error:--所有不能与refspec组合
用法:git push[][…]]
-v、 ——冗长,更冗长
-q、 ——安静点,安静点。。。。。。。。。。。。。。。。。
-u、 --为git pull/status设置上游设置上游
...........................

一个简单的
git-push-u原始主机就足够了:不需要
--all

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


有关详细信息,请参见“

git push
with
-u
为分支设置上游,它是一个子命令,需要refspec(参考规范:branch、commit等),因此不能与--all一起使用


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

我尝试了
git-push-all-origin
,整个项目似乎都上传了。我不确定这是否是正确的方法。不,git push-u origin master
更好:请参阅我在下面的回答中提到的链接。两者都可以,取决于您想做什么。如果你想“上传(一个)项目”,我会说——一切都很顺利,这要看情况而定。对于第一次提交推送多个分支,一次推送所有内容绝对有用…@Knut我同意。但不知何故,对于第一个被置于版本控制之下的项目,我怀疑有那么多分支。这可能是完全正确的…:)