Using git 1.6.4.2, when I tried a git pull
I get this error:
error: unable to resolve reference refs/remotes/origin/LT558-optimize-sql: No such file or directory From git+ssh://remoteserver/~/misk5 ! [new branch] LT558-optimize-sql -> origin/LT558-optimize-sql (unable to update local ref) error: unable to resolve reference refs/remotes/origin/split-css: No such file or directory ! [new branch] split-css -> origin/split-css (unable to update local ref)
I've tried git remote prune origin
, but it didn't help.
If I have a file open in a Mac app from a repo that's located on the Windows VM, I sometimes get the "unable to update local ref" error. The solution when this happens is to simply close the file or quit the Mac app. This is exactly what my situation was.
Solution. Unsure the root cause of the "reference broken". To fix it, delete this file . git/refs/remotes/origin/master , and git fetch to retrieve it back.
git directory to ensure that no other Git process takes place during the operation. "error: cannot lock ref" simply means information in /refs are corrupted and Git cannot continue to create index. lock file.
Git fetch summary In review, git fetch is a primary command used to download contents from a remote repository. git fetch is used in conjunction with git remote , git branch , git checkout , and git reset to update a local repository to the state of a remote.
Try cleaning-up your local repository with:
$ git gc --prune=now $ git remote prune origin
man git-gc(1):
git-gc - Cleanup unnecessary files and optimize the local repository git gc [--aggressive] [--auto] [--quiet] [--prune=<date> | --no-prune] Runs a number of housekeeping tasks within the current repository, such as compressing file revisions (to reduce disk space and increase performance) and removing unreachable objects which may have been created from prior invocations of git add. Users are encouraged to run this task on a regular basis within each repository to maintain good disk space utilization and good operating performance.
man git-remote(1):
git-remote - manage set of tracked repositories git remote prune [-n | --dry-run] <name> Deletes all stale remote-tracking branches under <name>. These stale branches have already been removed from the remote repository referenced by <name>, but are still locally available in "remotes/<name>".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With