james james - 11 days ago 6
Git Question

Git error: --all can't be combined with refspecs

I have a java based dynamic web project in eclipse which is placed under git for source control.
I want to upload this project into a repository in bitbucket. To do that, I used the commands
below -

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


The second command gives me an error. Please tell me why this happens and how do I fix it.

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
...........................

Answer

git push with -u sets upstream for a branch, it's a subcommand expecting a refspec (reference specification: branch, commit etc.), so it cannot be used with --all.

git push --all origin is the correct way to do it.