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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,467,464
Community Members
 
Community Events
177
Community Groups

How to resolve: git push remote: error: cannot lock ref .... /refs/head/develop.lock exists

Edited

I'm struggling to solve an issues with one of my repositories. It started with a failed push from sourcetree, on attempting to push it again, or to run it in the shell, I am given this error:

emote: error: cannot lock ref 'refs/heads/develop': Unable to create '..../refs/heads/develop.lock': File exists.
remote:
remote: Another git process seems to be running in this repository, e.g.
remote: an editor opened by 'git commit'. Please make sure all processes
remote: are terminated then try again. If it still fails, a git process
remote: may have crashed in this repository earlier:
remote: remove the file manually to continue.

But I don't know how I can access the remote to delete the file? 

I can see others on here with similar problems but I didn't find a resolution...

 

UPDATE: 

I can still work with the repository in other ways - I've branched develop to a temporary branch for now.

Is my best bet is to delete the remote branch and push again? 

 

UPDATE TWO:

For future reference: Issues like this require access to the remote repo to resolve properly, so it requires support from Atlassian. 

For free plan users (like me) the best way to get that support is via this community board.

 

Thanks everyone!

 

3 answers

1 accepted

1 vote
Answer accepted
Caroline R Atlassian Team Feb 04, 2022

Hi, @Joe Dahl-Fisher, welcome to the community! 

As we will need to access the repository to remove this lock file, I went ahead and created an internal ticket for you using the email of your community account, so you don't have to share this information here. 

You should have received an email with a link to the support ticket. Just in case you haven't received it, please feel free to let me know and I can post the ticket URL here. The ticket will be visible only to you and Atlassian staff, no one else can view its contents even if they have the URL.

Please let me know if you have any questions.

Kind regards,
Caroline

Thanks Caroline, I've been in contact with support and the problem is now resolved.

Like Caroline R likes this

I am getting this same issue now. Who can I contact for support?

0 votes

Soln:

Step 1: remove mentioned reference

rm .git/refs/heads/develop

Step 2: git fetch

Step 3: git pull

 

 Will work 100% sure...

0 votes
Vishwas Rising Star Feb 03, 2022

Hey @Joe Dahl-Fisher 

Welcome to Atlassian Community !!

Try running below command in git bash inside that repository folder.

First one shows what happens to the repo before doing an actual command which is second one.

git remote prune origin --dry-run
git remote prune origin

 Let me know how it goes.

 

Regards,

Vishwas

Hey, thanks for getting back to me. No luck unfortunately! The command doesn't seem to find anything to prune.

Vishwas Rising Star Feb 03, 2022

Can you send me a screenshot so that i can understand better.

Also did you do git gc ? that was another method to fix.

Here is the output from my shell:
joe@Joes-MacBook-Pro maya_utils % git remote prune origin --dry-run
joe@Joes-MacBook-Pro maya_utils % git remote prune origin
joe@Joes-MacBook-Pro maya_utils % git push
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: error: cannot lock ref 'refs/heads/develop': Unable to create '...././refs/heads/develop.lock': File exists.

remote:
remote: Another git process seems to be running in this repository, e.g.
remote: an editor opened by 'git commit'. Please make sure all processes
remote: are terminated then try again. If it still fails, a git process
remote: may have crashed in this repository earlier:
remote: remove the file manually to continue.

I tried GC too, but it didn't help

I wonder if the best option is just to delete the remote develop branch and push the local again? Given that its currently me using this repo...

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events