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!
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Soln:
Step 1: remove mentioned reference
rm .git/refs/heads/develop
Step 2: git fetch
Step 3: git pull
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This does not work. Please don't submit false solutions stating they "will work 100%" as it has the potential to ruin some peoples working environment.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, I've updated the comments.
But in my case, whenever i faced this issue i used to follow above mentioned steps and it works in my case.
Apologies..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This solution was the only one that worked for me, just you have to update the path to target your affected reference. also note the '.git'
thanks mate.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, thanks for getting back to me. No luck unfortunately! The command doesn't seem to find anything to prune.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you send me a screenshot so that i can understand better.
Also did you do git gc ? that was another method to fix.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.