Whiny git – getting rid of the ‘You did not specify any refspecs’ error

Newer versions of git will complain if you just do a

git push

in your current branch to push it to a remote:

pleb:funpop will$ git push
warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning: 'nothing' : Do not push anything
warning: 'matching' : Push all matching branches (default)
warning: 'tracking' : Push the current branch to whatever it is tracking
warning: 'current' : Push the current branch
Counting objects: 37, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (20/20), done.
Writing objects: 100% (21/21), 4.58 KiB, done.
Total 21 (delta 11), reused 0 (delta 0)
To git@github.com:wjessop/Funpop.git
e9ca06a..5507c19 master -> master

You can get rid of this by just doing:

git config --add push.default current

and now git will work like it did before, without the noise.

Tagged

7 thoughts on “Whiny git – getting rid of the ‘You did not specify any refspecs’ error

  1. gordon yeong says:

    thanks a lot :) Worked like a charm ;)

  2. makuchaku says:

    Thanks – this was exactly what I was looking for :)

  3. Francis Fish says:

    Cheers – I wonder why it changed?

  4. Manish says:

    Thanx man….

  5. kasidit says:

    Thanks! Worked perfectly.

  6. Wesal says:

    Thanks.
    Adds the following to .git/config

    > [push]
    > default = current

  7. Marcus says:

    you might want to put a –global in the command too, like so

    git config –global –add push.default current

    Now git never whines again! Thanks for the article too.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.