It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Unable to push renamed branch to Stash

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

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.

Hi Balazs,

This post by slacy has similar symptoms:

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)?



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.

Tim, Do you have any other suggestions?

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.



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
Community showcase
Published in Bitbucket

Powering DevOps with Bitbucket Server & Data Center

Hi everyone, The Cloud team recently announced 12 new DevOps features that help developers ship better code, faster   ! While we’re all excited about the new improvements to Bitbucket ...

630 views 0 4
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you