Take the 2-minute tour ×

I've seen people use

$ git push

and it pushes to their default remote repo/branch

I've been using

$ git push hm master

What settings do I need to change so when I type:

$ git push

I don't see this error:

fatal: No configured push destination.
Either specify the URL from the command-line or configure a remote repository using

    git remote add <name> <url>

and then push using the remote name

    git push <name>
share|improve this question
Or maybe I haven't seen this, and I just /thought/ I did? –  jessh Jul 20 '12 at 15:43

2 Answers 2

up vote 2 down vote accepted

git push will try to push to the upstream repository. It looks like you have non configured for your branch. Use git branch --set-upstream [local_branch_name] [remote_name/remote_branch_name]

share|improve this answer
mm:cpp $ git remote -v hm ssh://[obscured]/~/public_html/[obscured]/hub.git (fetch) hm ssh://[obscured]/~/public_html/[obscured]/hub.git (push) –  jessh Jul 20 '12 at 15:50
I suppose my question is: 'How do I config the /default/ remote repo?' –  jessh Jul 20 '12 at 15:51
@jessh So, you have the right remote configured, but your upstream repository isn't set correctly. –  pmr Jul 20 '12 at 15:55

You won't be able to do this, unless you do some wonky custom script in bash which intercepts your git command and automatically adds the [alias] [branch] elements to git push. Git has to know what to push and where. For comparison, bear in mind that you can't do a grep without any additional variables, because it just won't do anything.

share|improve this answer
I think you might be right. I just set up a bash alias: alias gp='git push hm master'. –  jessh Jul 20 '12 at 15:48
No, argument-less git push uses the upstream branch that is set. No need for wonky scripts. –  pmr Jul 20 '12 at 15:56
Good point... I did not know that. Thanks. –  karmalis Jul 20 '12 at 22:12

Your Answer


