Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Unable to push renamed branch to Stash

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 17, 2014

I wanted to rename a branch in one of our (Git) repositories. The way to do this is to

  1. delete the branch on the server (done),
  2. rename the local branch (done)
  3. and then push the renamed branch to the server.

This last step fails, like this:

> git push origin New_Branch_Name
Counting objects: 1374, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (145/145), done.
Writing objects: 100% (478/478), 34.37 MiB | 8.36 MiB/s, done.
Total 478 (delta 349), reused 455 (delta 332)
remote: error: unable to write sha1 filename ./objects/pack/pack-c4fe98c613c55dc30b0e148d41c11a6fb68857ac.pack: Permission denied
remote: fatal: cannot store pack file
error: unpack failed: index-pack abnormal exit
To http://stash/repo_address.git
 ! [remote rejected] New_Branch_Name -> New_Branch_Name (unpacker error)
error: failed to push some refs to 'http://stash/repo_address.git'

[I can push to all the other repos on the server and all the other branches of this repo without problems.]

I tried the following:

  • searching for a process that has a lock on this file (there is none)
  • restarting the server to make sure there is no process locking the file (several times)
  • running git gc on the server in the repo's folder
  • running git gc --aggressive on the server (runs out of 2*32GB real+virtual RAM before it completes)
  • copying the whole repo folder to a different computer and trying to push to the copy (fails the same way, which makes me believe there is a problem with the pack file or one of its properties.)
  • checking the file permissions of the file mentioned (my user has Admin rights on the server and Admins have "full control" access to the file)

None of these change the result.

The repo is a live one with quite many active users and a history of ~100 pull requests I cannot afford to lose, so deleting and re-pushing the whole repo is not an acceptable option (unless there is a way to migrate the PR's to the new copy).

Any suggestions for what could be wrong and how I could fix it?

2 answers

1 accepted

2 votes
Answer accepted
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 3, 2014

I created a support request for this. The correct solution was to set <tt>core.createObject</tt> = <tt>link</tt> in the config of the server's bare repository.

0 votes
TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 18, 2014

Hi Balazs,

This post by slacy has similar symptoms:

http://slacy.com/blog/2009/09/git-error-unable-to-write-sha1-filename-permission-denied/

I'd try manually fixing the file as they suggest and setting the core.sharedRepository flag, if it isn't already.

What version of Stash are you using? Have you made any changes to the repository configuration on disk (outside of the Stash administration)?

cheers,

Tim

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 20, 2014

As said above, I already looked at the permissions and there is nothing more to give. (Also, all the other randomly sampled packfiles I checked in this repo and others have exactly the same settings.)

I set core.sharedRepository to "all", it does not change the output.

We have Stash 3.0.4 (but this problem has been with us since 2.11 or 2.12), on Windows Server 2008 R2. This core.sharedRepository setting I changed now is the only thing I changed outside of the web UI.

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2014

Tim, Do you have any other suggestions?

TimP
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 31, 2014

Hi again Balazs,

Sorry for the delay. I must admit I haven't seen anything like this before. At this point I'd contact our support team at https://support.atlassian.comso we can take a closer look at your Stash configuration and repository.

cheers,

Tim

John Hutchinson January 20, 2016

What was the fix in the end for this?  I think I have the same problem.  I'm using Stash v3.8.0.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events