Navigation

warning: push.default is unset; its implicit value has changed in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the traditional behavior, use:

git config –global push.default matching

To squelch this message and adopt the new behavior now, use:

git config –global push.default simple

When push.default is set to ‘matching’, git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative ‘simple’
behavior, which only pushes the current branch to the corresponding
remote branch that ‘git pull’ uses to update the current branch.

See ‘git help config’ and search for ‘push.default’ for further information.
(the ‘simple’ mode was introduced in Git 1.7.11. Use the similar mode
‘current’ instead of ‘simple’ if you sometimes use older versions of Git)

Let’s walk through setting up SSH access on the server side.
In this example, you’ll use the authorized_keys method for authenticating your users.
We also assume you’re running a standard Linux distribution like Ubuntu.
First, you create a git user and a .ssh directory for that user.

Next, you need to add some developer SSH public keys to the authorized_keys file for the git user.
Let’s assume you have some trusted public keys and have saved them to temporary files.
Again, the public keys look something like this:

You just append them to the git user’s authorized_keys file in its .ssh directory:

$ cat /tmp/id_rsa.john.pub >> ~/.ssh/authorized_keys

Now, you can set up an empty repository for them by running git init with the –bare option,
which initializes the repository without a working directory:

$ cd /path/to/prj
$ git init --bare sample_prj.git

Then, John, Josie, or Jessica can push the first version of their project into that repository
by adding it as a remote and pushing up a branch.
Note that someone must shell onto the machine and create a bare repository every time you want to add a project.

Another way to tag commits is with a lightweight tag.
This is basically the commit checksum stored in a file – no other information is kept.
To create a lightweight tag, don’t supply the -a, -s, or -m option:

Warning: push.default is unset; its implicit value is changing in Git 2.0¶

warning: push.default is unset; its implicit value is changing in
Git 2.0 from ‘matching’ to ‘simple’. To squelch this message
and maintain the current behavior after the default changes, use:

git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

git config --global push.default simple

matching means git push will push all your local branches to the ones with the same name on the remote.
This makes it easy to accidentally push a branch you didn’t intend to.

simple means git push will push only the current branch to the one that git pull would pull from,
and also checks that their names match. This is a more intuitive behavior, which is why the default is getting changed to this.

Fatal: The upstream branch of your current branch does not match the name of your current branch.¶

git checkout rc
git push

fatal: The upstream branch of your current branch does not match
the name of your current branch. To push to the upstream branch
on the remote, use

git push origin HEAD:v1.1

To push to the branch of the same name on the remote, use

git push origin v0.2

Git keeps track of which local branch goes with which remote branch. When you renamed the remote branch,
git lost track of which remote goes with your local rc branch.
You can fix this using the –set-upstream-to or -u flag for the branch command.