使用git 1.6.4.2时,当我尝试git pull时,会出现以下错误:

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)

我尝试过git远程梅干起源,但没用。


当前回答

我能够与

git remote update --prune

其他回答

我也有同样的问题。我遵循以下步骤

1) 将有问题的分支机构切换到其他分支机构

2) 删除该分支

3) 再次结账。

注意:-您可以隐藏未提交的更改,然后再次将其放回。

 # remove the reference file of the branch "lost"
 rm -fv ./.git/refs/remotes/origin/feature/v1.6.9-api-token-bot-reader
 
 # git clear everything 
 clear ; git reset HEAD --hard ; git clean -xdf ; 

 # subdue the current branch and pull all changes from the remote
 clear ; git fetch --all -p ; git pull --all --rebase ; clear ; git branch -a

 # git will "know" how-to handle the issue from now on
 #     From github.com:futurice/senzoit-www-server
 # * [new branch]      feature/v1.6.9-api-token-bot-reader ->
 # origin/feature/v1.6.9-api-token-bot-reader

 # and push your local changes
 git push

尝试使用以下方法清理本地存储库:

$ 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远程(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>".            

当存储库被删除并以相同的名称创建时,也面临同样的问题。它只在我重新设置远程url时起作用,如下所示;

git远程设置url来源[git_REPO_url]

验证远程url:

git remote -v

现在,所有命令都应该照常工作。

我能够与

git remote update --prune