66

I was trying to push and create a pull-request from my local feature-branch, as usual, being in my feature-branch and right-clicking on the remote origin/develop -branch (I'm using Git Flow), and this error message popped out:

enter image description here

Can't find anything with that error message. Any ideas?

Steve Waters
  • 3,348
  • 9
  • 54
  • 94

10 Answers10

73

I had this problem as well when there was a HEAD tag at a commit behind the current local master or origin/master.

Try double-clicking your local master (which eliminates HEAD) and then push your changes.

Note that if you do not have a local master, right-click on remote origin master and choose 'Checkout origin/master'. Then pull, commit, push your changes.

notedible
  • 983
  • 7
  • 9
29

Going to add my tuppence here. I had a casing mismatch on a folder between a local branch and the remote.

Make sure when you create a branch that the case matches remote i.e. if your remote folder is called Task, don't create a local branch called task\1234-my-task, it must be Task\1234-my-task.

gfyans
  • 1,236
  • 1
  • 16
  • 21
  • This was my problem also. I already had a remote branch named "Ingve" and when I tried to push a local branch named "ingve" I got the same push error as the thread starter. – Liknes Nov 16 '18 at 13:18
  • 1
    Same problem for me! Remote branch was "Hotfix" and local branch was "hotfix" – Neophear May 05 '20 at 17:56
  • It was indeed a casing mismatch between the Remote and the Local repos. I'm wondering if GitKraken devs have considered a more useful error message suggesting a possible solution. – Alverson Layne Jun 10 '21 at 16:25
7

The fix by @notedible didn't work for me. But it led me to simply going to the command line and doing a git status

$ git status
On branch feature/RES-523
Your branch and 'origin/feature/RES-523' have diverged,
and have 13 and 2 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
nothing to commit, working tree clean

$ git pull
From https://bitbucket.org/my-repo
 * [new branch]        feature/RES-523 -> origin/feature/RES-523
Auto packing the repository in background for optimum performance.
See "git help gc" for manual housekeeping.
Already up-to-date.

Boom! Good to go.

Nate Ritter
  • 2,386
  • 3
  • 20
  • 28
  • By simply pulling in this situations, can't you make a huge merge mess? Or is everybody working on different files? I just made a mess with my own personal repository in a divergent branch... 10 minutes wasted fixing a merge =( – NicoBerrogorry Aug 20 '18 at 20:16
  • @NicoBerrogorry it didn't create a mess for me. Not sure if it would, theoretically, with others. It was only my own repo which had the issue, and pushing it didn't seem to screw anyone else up, likely because I was the only one working on that branch at that time. So, when it was fixed and I merged it back in, all seemed to work as it should. – Nate Ritter Nov 29 '18 at 02:31
  • Doing the command line will illustrate the underlying issue causing this. The reported error is more of a general exception. In my case, the command line revealed that I needed to re-authenticate with the Git repo. – Will Strohl Oct 01 '19 at 21:15
5

This happens to me when we have branches that are mixed case and using GitKraken. If I rename to consistent casing, it works fine. In my case the GIT remote repository had, unintentionally, two branch folders one with mixed case and one with lowercase. My GitKraken matched the mixed case, but since the lower case existed, I got this error.

The resolution was to clean up the remote branch name so there was no ambiguity to the remote names, then the GitKraken error was resolved.

https://support.gitkraken.com/known-issues/common-errors/#error-when-pushing-a-branch

Brilldav
  • 185
  • 2
  • 5
3

I had the same problem. My branch name had an apostrophe in it (Richie'sVersion). I created a new branch from the existing branch (essentially a copy of the existing branch) and gave it a name without an apostrophe (RichiesVersion) and this resolved the problem. Pushing the new branch worked fine.

2

I know this answer may not be the most popular, but I ran into this problem today and none of the above solutions worked. I finally got fed up with the GUI and after committing my changes I switched to CLI and pushed the branch from there. Git handled it without any issues. No disrespect to GitKraken- I upgraded to a Pro license because its a good tool.

William Smith
  • 1,949
  • 4
  • 25
  • 45
1

You just have to temporarily rename your branch the error appears, then push and then again rename the branch.

e.g.: branch feature/coolBranch -> feature/tmpcoolbranch (push here) -> feature/coolBranch

That's it.

Me3nTaL
  • 139
  • 2
  • 11
1

Look like this error is pretty generic and the problem coming from GitKraken itself somehow. In my case, I can use CLI to work with git as usual but when I try to push my commit, this error appears. I try all of the solutions above and cannot solve the problem.

So I decide to remove the local folder, clone the repo again then the problem is fixed.

Natechawin
  • 316
  • 1
  • 5
0

The error is certainly not very useful, as evidenced by the various causes captured in the answers here. I just experienced this error as well, and to add one more potential cause to the list, in my case it was because:

A remote branch already exists with the same name as the branch being pushed. In this case, the solution is to either choose a different (unique) name for the local branch being pushed, or delete the remote branch with the same name.

I had created a new branch with a fairly generic name. When I tried to push, I received this error. I tried a few different things to no avail, even including deleting the local repository and cloning again. To my great surprise, I received the same error on the fresh repository with a new branch.

I noticed that the remote repository had a lot of stale branches that had never been cleaned up, and the thought occurred to me that perhaps the cause could be a name clash. I decided that cleaning up all the old branches was a good thing to do anyway, so I deleted them all. After that I was able to push my branch successfully.

Definitely a pretty bad user experience. A more meaningful message that describes the problem, or at least some of the common causes such as this, would be nice.

label17
  • 153
  • 6
0

Today, July 8, 22, I had the same problem. Curiously, I had Visual Studio Code open and it indicated that I had a commit to upload.

It is important to mention that I was not logged into VSC, when trying to PUSH I was asked to login and PUSH could be performed.

Of course, I still hadn't solved the problem and what I did was check the configuration and credentials of both GitHub and GitLab.

At that moment I realized that by accident, the domain names of my email accounts were wrong, I had written the email wrong (Very strange fact, since before I had been allowed to push)

Once the email in the profiles area was updated, I logged out of gitlab and logged back in. This ultimately allowed me to push from GitKraken.

On GitKraken, integrations (logins), whether GitLab or GitHub, are independent of the profile. In my profile, I had a wrong email.

The problem was not in the wrong email of my profile, since when doing it with VSC, the commits I made have the wrong email.

The issue was resolved by logging out and back in


El día de hoy 8 de julio 22 tuve el mismo problema, curiosamente tenía abierto Visual Studio Code y me indicaba que tenía un commit para subir.

Es importante mencionar que no estaba logueado dentro de VSC, al intentar realizar PUSH me solicito login y se pudo realizar PUSH.

Por supuesto, aún no había resuelto el problema y lo que realicé fue revisar la configuración y credenciales tanto de GitHub como de GitLab.

En ese momento me percaté que por accidente, los nombres de dominios de mis cuentas de email estaban mal, había escrito mal el email (Dato muy extraño, ya que antes me había permitido realizar push)

Una vez actualizado el email en el área de perfiles, cerre sesión de gitlab y volví a acceder. Esto al final me permitió poder realizar push desde GitKraken.

En GitKraken, las integraciones (logins), ya sea GitLab o GitHub, son independientes a el perfil. En mi perfil, tenía un email erroneo.

El problema no estaba en el email erroneo de mi perfil, ya que al realizarlo con VSC, los commits que realicé tienen el email erroneo.

El problema se resolvió cerrando sesión y volviendo a acceder

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jul 10 '22 at 15:46