On my iMac, I can do git push
and it works fine. But on my Macbook, I have to use git push origin <branchname>
. The .git/config files on the two are the same, repo is the same - what's the difference?
Asked
Active
Viewed 66 times
0

Scott C Wilson
- 19,102
- 10
- 61
- 83
-
1What versions of Git are installed on the two machines? What upstream, if any, is set for the current branch in each case? (I'm assuming you are not doing either push from "detached HEAD" mode.) – torek May 17 '16 at 09:33
2 Answers
2
There was a change in the push.default config value: It used to be: matching
and now it is simple
this may cause the difference. You can set this config value as desire, see: git-config for explanation on those values (and more values available).

Chananel P
- 1,704
- 1
- 18
- 19
-
That was it. On the Macbook the default was `matching`, but on my iMac it was `current.` I like current so I used `git config --global push.default current` on the Macbook to fix this. – Scott C Wilson May 18 '16 at 09:49
1
Normally only the first push of a new local branch should require git push -u origin branchname
to set a remote tracking branch to your local one. The following pushes should work with git push
because Git already knows what the remote of this local branch is.
See also: git push vs git push origin <branchname>