I am getting the following error while trying to push the changes to remote repository.
Command
git push heroku
Error
fatal: You are pushing to remote 'heroku', which is not the upstream of
your current branch 'master', without telling me what to push
to update which remote branch.
Can anyone please advise what might be causing the same?
We can fix the error: failed to push some refs to [remote repo] error in Git using the git pull origin [branch] or git pull --rebase origin [branch] commands. In most cases, the latter fixes the error.
If git push origin master not working , all you need to do is edit that file with your favourite editor and change the URL = setting to your new location. Assuming the new repository is correctly set up and you have your URL right, you'll easily be able to push and pull to and from your new remote location.
In order to push a Git branch to remote, you need to execute the “git push” command and specify the remote as well as the branch name to be pushed. If you are not already on the branch that you want to push, you can execute the “git checkout” command to switch to your branch.
To push a branch on remote, your branch needs to have the latest changes present in remote repository. If you get the failed to push error, first do git pull the branch to get the latest commits and then push it.
I suspect you don't have remote configured.
push likes to know WHAT to push and WHERE to push it. Usually one configures git so that it automatically tracks branches (local - remote pairs).
Try pushing: git push heroku master
assuming master is your local branch and heroku is a remote.
Also, to see if remote is not configured, (l)ist your config or (e)dit it:
git config -l / -e
Since Felix was before me, I'll extend my answer with setting the remote:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With