In Git-config you can see:
branch.name.remote
When on branch <name>, it tells git fetch and git push which remote to fetch from/push to. The remote to push to may be overridden with remote.pushDefault (for all branches). The remote to push to, for the current branch, may be further overridden by branch.<name>.pushRemote. If no remote is configured, or if you are not on any branch, it defaults to origin for fetching and remote.pushDefault for pushing.
Now I have a cloned
repository and a branch which is named test
and is checkouted. Here you can see contents of config
file of the cloned repository:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = ...
fetch = +refs/heads/*:refs/remotes/origin/*
[branch "master"]
remote = origin
merge = refs/heads/master
As you see, branch.
test
.pushRemote
, remote.pushDefault
and branch.
test
.remote
are not set there. So I expect when I do
$ git push
I will get
fatal: No configured push destination.
But I get
Everything up-to-date
It seems Git
uses origin
instead of not configured remote.pushDefault
. But why when docs say
it defaults to remote.pushDefault for pushing.
Edit:
In Git-push you can see:
When the command line does not specify where to push with the <repository> argument, branch.*.remote configuration for the current branch is consulted to determine where to push. If the configuration is missing, it defaults to origin.
It think there is a conflict between using origin
and remote.pushDefault
.