Git and the nasty "error: cannot block existing information / refs fatal"

After cloning from a remote git repository (with better codes) I made some changes, made and tried to click:

git push origin master 

Errors with:

error: cannot block existing information / refs
fatal: git-http-push failed

In this case, the existing repository is considered.

What I did before was:

  • git config –global http.sslVerify false
  • git init
  • git remote add [url]
  • git clone
  • To change the data
  • git commit

In 'bestcodes' I don't have access to git log.

I am using windows. Detailed error:

 C:\MyWorkStuff\Projects\Ruby\MyProject\>git push origin master Unable to create branch path https://user:password@git.bettercodes.org/myproject/info/ error: cannot lock existing info/refs fatal: git-http-push failed 

I cloned earlier, then changed the code and committed it.

+224
git
Jul 11 2018-11-21T00:
source share
16 answers

Do you want to try:

 git gc --prune=now 

See https://www.kernel.org/pub/software/scm/git/docs/git-gc.html

+356
Jul 08 '16 at 17:47
source share

For me it worked:

git remote prune origin

Since this answer seems to help a lot of people, I went a little deeper into what is actually going on here. To do this, delete the links to remote branches in the folder .git/refs/remotes/origin . So this will not affect your local branches and will not change anything remote, but will update your local links to remote branches. It seems that in some cases, these links may contain data that Git cannot process correctly.

+354
Apr 6 '17 at 11:04 on
source share

This happened to me when my git remote (bitbucket.org) changed its IP address. A quick fix was to remove and re-add the remote, then everything worked as expected. If you are not familiar with how to remove and re-add remote access to git, follow these steps:

  • Copy the SSH git URL of your existing remote. You can print it to the terminal using this command:

    git remote -v

which will output something like this:

  origin git@server-address.org:account-name/repo-name.git (fetch) origin git@server-address.org:account-name/repo-name.git (push) 
  1. Remove the remote from the local git repository:

    git remote rm origin

  2. Add the remote server back to the local repo:

    git remote add origin git@server-address.org:account-name/repo-name.git

+174
Mar 28 '16 at 18:22
source share

I fixed this by doing the following

 git branch --unset-upstream rm .git/refs/remotes/origin/{branch} git gc --prune=now git branch --set-upstream-to=origin/{branch} {branch} #or git push --set-upstream origin {branch} git pull 

This assumes that your local and remote branches are aligned, and you just get the refs error as not fatal.

+18
Nov 08 '16 at 13:28
source share

Running the git update-ref -d refs/heads/origin/branch command fixed this.

+16
Jul 26 '18 at 13:36
source share

This is probably resolved by now. But here is what worked for me.

  • Location:

    • If the locked repository is on the server side:

      • ssh to the git repository on the server.
      • Log in as a user who has permissions to change the repository and go to the repository on your server.
    • If the locked repository is only local:

      • Open the git console and go to the repository directory.
      • Run this command:

         git update-server-info 
  • Correct permissions for your (remote or / or local) repository if you need to. In my case, I had to chmod before 777 and chown before apache:apache

  • Try clicking again from the local repository:

     git push 
+10
Mar 02 2018-12-12T00:
source share

I had this problem because I was on a branch whose name was like an upstream branch. that is, the upstream branch was called example-branch and my local branch was called example-branch/backend . The solution was to change the name of my local branch as follows:

 git branch -m <new name goes here> 
+8
Feb 14 '18 at 3:47
source share

Here's how it works for me.

  • Locate the Apache DAV lock file on your server (e.g. / var / lock / apache2 / DAVlock)
  • delete it
  • recreate it with write permissions for the web server
  • restart web server

An even faster alternative:

  • Locate the Apache DAV lock file on your server (e.g. / var / lock / apache2 / DAVlock)
  • Empty file: cat /dev/null > /var/lock/apache2/DAVlock
  • restart web server
+6
Jul 09 2018-12-12T00:
source share

This sounds like a permission issue - is it possible that you have opened two windows that perform separate rights? Perhaps check ownership of the .git folder.

Maybe check if open file lock is open, maybe use lsof to check or your OS equivalent.

+4
Jul 11 2018-11-18T00:
source share

In my case, the branch was moved to a subdirectory, and the directory was called as a branch. Git was confused by this. When I deleted the local branch (in SourceTree with the removal of the right mouse button), everything works as usual.

+2
May 12 '16 at 9:54 a.m.
source share

Update:

You may need to edit the ~ / .netrc file:

https://bugs.launchpad.net/ubuntu/+source/git-core/+bug/293553

Original answer:

Why did you disable ssl? I think this may be due to the fact that you cannot click through https. I returned it and try again to click:

 git config –global http.sslVerify true 
+1
Jul 11 2018-11-11T00:
source share

I had this problem when I tried to create a new function branch that contained the name of the old branch, for example origin - branch1, and I wanted to create the function branch1. This was not possible, but branch1 / feature already existed.

+1
May 7 '19 at 11:18
source share

Make sure that you (the git process actually) have access to the .git/info/refs file, and this file is not blocked by another process.

0
Jul 11 2018-11-18T00:
source share

In the case of bettercodes.org, the solution is more poetic - the only problem may be the rights assigned to project members. Simple members do not have write permissions! Make sure you have moderator or administrator privileges. Of course, this must be installed on bestcodes.org in the project settings by the administrator.

0
Jan 12 2018-12-12T00:
source share

I saw this error when trying to run git filter-branch to detach many subdirectories to a new separate repository (as in this answer ).

I tried all of the above solutions, and none of them worked. In the end, I decided that I did not need to save all these tags in a new branch, and simply ran:

 git remote remove origin git tag | xargs git tag -d git gc --prune=now git filter-branch --index-filter 'git rm --cached -qr --ignore-unmatch -- . && git reset -q $GIT_COMMIT -- apps/AAA/ libs/xxx' --prune-empty -- --all 
0
Jul 11 '18 at 21:55
source share

In my case, this was due to the branch name that I already created.
First, I created a branch with some name that probably should not exist, for example:

 git checkout -b some_unknown_branch 

then I cleared all the rest of my branches because they were just unnecessary garbage.

 git branch | grep -v \* | grep -v master | xargs git branch -D 

and then renamed my branch to the name I intended, for example:

 git checkout -m my_desired_branch_name 
0
Nov 02 '18 at 11:38
source share



All Articles