Skip to content

Error: Cannot lock ref 'refs/remotes/origin/master' #6121

Closed

Description

@arbuzzer

I have some problem with my GitHub. I read similar questions and answers to them in many forums, but unfortunately nothing helped.

error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference
'refs/remotes/origin/master': reference broken
From https://github.com/arbuzzer/arbuzzer.github.io
! [new branch] master -> origin/master (unable to update local ref)

Activity

  1. changed the title [-]Error: Cannot lock ref ...[/-] [+]Error: Cannot lock ref 'refs/remotes/origin/master'[/+] on Nov 7, 2018
  2. billygriffin commented on Nov 7, 2018

    @billygriffin
    Contributor

    Hi @arbuzzer, thanks for the report and sorry you're having issues.

    We ask that folks fill out the template so we can better understand your setup and what's going on so we make the best use of the maintainers' time. Here's the template you need: https://github.com/desktop/desktop/issues/new?template=bug_report.md

    Thanks for understanding and meeting us halfway! 😄

  3. added
    more-info-needed
    on Nov 7, 2018
  4. steveward commented on Nov 7, 2018

    @steveward
    Contributor

    @arbuzzer It looks like there may be some underlying repository corruption that is causing this issue. Could you go to the file menu in GitHub Desktop and select Repository > Open in <your_default_command_line_application> and run the command git fsck? That should give some some more information about this error. Please share the full output of that command.

  5. arbuzzer commented on Nov 7, 2018

    @arbuzzer
    Author

    @arbuzzer It looks like there may be some underlying repository corruption that is causing this issue. Could you go to the file menu in GitHub Desktop and select Repository > Open in <your_default_command_line_application> and run the command git fsck? That should give some some more information about this error. Please share the full output of that command.

    image

  6. arbuzzer commented on Nov 7, 2018

    @arbuzzer
    Author

    Hi @arbuzzer, thanks for the report and sorry you're having issues.

    We ask that folks fill out the template so we can better understand your setup and what's going on so we make the best use of the maintainers' time. Here's the template you need: https://github.com/desktop/desktop/issues/new?template=bug_report.md

    Thanks for understanding and meeting us halfway! 😄

    Description

    error: cannot lock ref 'refs/remotes/origin/master': unable to resolve reference
    'refs/remotes/origin/master': reference broken
    From https://github.com/arbuzzer/arbuzzer.github.io
    ! [new branch] master -> origin/master (unable to update local ref)

    Version

    *GitHub Desktop:
    image

    *Operating system:
    image

    Steps to Reproduce

    1. I read the whole topic on this site and none of the proposed solutions helped me. (https://stackoverflow.com/questions/2998832/git-pull-fails-unable-to-resolve-reference-unable-to-update-local-ref)

    Expected(Blue Box) and Actual(Red Box) Behavior

    1. image
    2. image
      3.image
      And so with every command that people offer.

    Additional Information

    Profile-20181107T180828.zip

    Logs

    2018-11-07.desktop.production.log
    2018-10-03.desktop.production.log
    2018-10-02.desktop.production.log
    2018-09-11.desktop.production.log
    2018-09-10.desktop.production.log
    2018-09-07.desktop.production.log
    2018-09-05.desktop.production.log
    2018-09-04.desktop.production.log
    2018-09-03.desktop.production.log
    2018-09-01.desktop.production.log

  7. steveward commented on Nov 7, 2018

    @steveward
    Contributor

    Thanks for sharing that information @arbuzzer. A few other questions:

    • Based on the screenshot it looks like you are were running those commands in your root directory (i.e. C:\Users\Your_User) -- is that the correct location of this repository, or is it possibly in a different directory? If you are storing this repository in a different location you will need to run Git commands from within that directory that contains your repository.
    • Is this a repository that you just freshly cloned to your local machine using GitHub Desktop?

    It would also be helpful if you could run the following two commands within the repository directory to provide more configuration information about your local repository:

    git branch -a
    git config -l --list

    Please let me know the output of both of those commands

  8. arbuzzer commented on Nov 7, 2018

    @arbuzzer
    Author

    Thanks for sharing that information @arbuzzer. A few other questions:

    • Based on the screenshot it looks like you are were running those commands in your root directory (i.e. C:\Users\Your_User) -- is that the correct location of this repository, or is it possibly in a different directory? If you are storing this repository in a different location you will need to run Git commands from within that directory that contains your repository.
    • Is this a repository that you just freshly cloned to your local machine using GitHub Desktop?

    It would also be helpful if you could run the following two commands within the repository directory to provide more configuration information about your local repository:

    git branch -a
    git config -l --list

    Please let me know the output of both of those commands

    image
    image
    image

  9. arbuzzer commented on Nov 7, 2018

    @arbuzzer
    Author

    Thanks for sharing that information @arbuzzer. A few other questions:

    • Based on the screenshot it looks like you are were running those commands in your root directory (i.e. C:\Users\Your_User) -- is that the correct location of this repository, or is it possibly in a different directory? If you are storing this repository in a different location you will need to run Git commands from within that directory that contains your repository.
    • Is this a repository that you just freshly cloned to your local machine using GitHub Desktop?

    It would also be helpful if you could run the following two commands within the repository directory to provide more configuration information about your local repository:

    git branch -a
    git config -l --list

    Please let me know the output of both of those commands

    I did all the actions described on the forums again and that's what I did. Expected(Blue Box) and Actual(Red Box) Behavior.

    image
    image
    image

  10. steveward commented on Nov 7, 2018

    @steveward
    Contributor

    Thanks @arbuzzer. Try running the command git fetch --all to grab the remote origin/master branch again. That should hopefully fix this issue.

  11. arbuzzer commented on Nov 8, 2018

    @arbuzzer
    Author

    Спасибо @arbuzzer . Попробуйте запустить команду, git fetch --allчтобы origin/masterснова захватить удаленную ветку. Это, надо надеяться, исправить эту проблему.

    image

  12. arbuzzer commented on Nov 8, 2018

    @arbuzzer
    Author

    Thanks @arbuzzer. Try running the command git fetch --all to grab the remote origin/master branch again. That should hopefully fix this issue.

    Maybe it will help me to reinstall the system, or is it easier for me to create a new account? It is just important for me to use this application.

  13. steveward commented on Nov 8, 2018

    @steveward
    Contributor

    @arbuzzer apologies -- I think we need to clean things up before running that command. Try these steps:

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    Let me know if that doesn't get things working.

  14. arbuzzer commented on Nov 8, 2018

    @arbuzzer
    Author

    @arbuzzer apologies -- I think we need to clean things up before running that command. Try these steps:

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    Let me know if that doesn't get things working.

    It doesn't work :(
    image

  15. steveward commented on Nov 8, 2018

    @steveward
    Contributor

    @arbuzzer sorry about that -- you will need to run del .git/refs/remotes/origin/master since you are using the command prompt.

    Maybe it will help me to reinstall the system, or is it easier for me to create a new account? It is just important for me to use this application.

    If you would like you can also perform a fresh clone of the repository to GitHub Desktop -- a fresh clone will not have the issues you are encountering.

  16. 6 remaining items

  17. Ngwind commented on Mar 30, 2019

    @Ngwind

    nice!this solved my problem

  18. arpitgupta19 commented on Jun 6, 2019

    @arpitgupta19

    This worked for me :
    git remote prune origin

  19. xiye520 commented on Dec 4, 2019

    @xiye520

    git remote prune origin
    This worked for me too!

  20. donprecious commented on Jan 31, 2020

    @donprecious

    Try

    $ git gc --prune=now
    $ git remote prune origin
    

    cleaning-up your local repository with:

  21. sugoireed commented on Mar 4, 2020

    @sugoireed

    After searching constantly, this is the solution that worked for me which entails unsetting/removing the Upstream

     git branch --unset-upstream
    
  22. briancalma commented on Apr 17, 2020

    @briancalma

    git branch --set-upstream-to=origin/master

    It worked like a charm! Thanks

  23. richierich25 commented on Apr 29, 2020

    @richierich25

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    --> This worked for me magically.

  24. Dzone1658 commented on May 11, 2020

    @Dzone1658

    git fetch --all
    git branch --set-upstream-to=origin/master

    /* This one works for me */
    thanks a lot.

  25. rishabh-mmc commented on Jul 2, 2020

    @rishabh-mmc

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    --> This worked for me magically.

    @richierich25 worked for me too
    thanks

  26. BellatrixLeStranger commented on Jul 4, 2020

    @BellatrixLeStranger

    I had a similar issue running VSCode on Windows 10 and trying to commit changes or push. However what solved it for me was changing my controlled folder access in Windows settings which was preventing git from creating the .lock files locally.

  27. mkkmail commented on Dec 14, 2020

    @mkkmail

    @arbuzzer apologies -- I think we need to clean things up before running that command. Try these steps:

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    Let me know if that doesn't get things working.

    This worked for me. Thanks!

  28. PETEROLO291 commented on Jan 26, 2021

    @PETEROLO291

    None of the previous methods worked for me, so what I did was make a copy of the folder, delete the folder, go to GitHub Desktop, clone the repository, paste the files that I had modified that I couldn't upload and that's it.

  29. AshutoshSajan commented on Sep 21, 2021

    @AshutoshSajan

    @arbuzzer apologies -- I think we need to clean things up before running that command. Try these steps:

    rm .git/refs/remotes/origin/master
    git fetch
    git branch --set-upstream-to=origin/master

    Let me know if that doesn't get things working.

    thank you

  30. CopyBug commented on Oct 21, 2021

    @CopyBug

    @arbuzzer道歉——我认为我们需要在运行该命令之前清理一下。尝试以下步骤:
    rm .git/refs/remotes/origin/master
    git fetch
    `git branch --set-upstream-to=origin/maste
    谢谢你

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions