git fetch keeps failing

2019-08-21 18:19发布

问题:

I created a branch on Ms TFS and I tried to pull it on to my local machine with the code:

git fetch

This is the result of the fetch:

error: cannot update the ref 'refs/remotes/origin/tryYourself/192RestService': unable to create directory for '.git/logs/refs/remotes/origin/tryYourself/192RestService': No such file or directory
From "url"
 ! [new branch]      tryYourself/192RestService -> origin/tryYourself/192RestService  (unable to update local ref)

Then I searched it on Google and StackOverflow, and they told me to do:

git gc --prune=now

And also:

git remote prune origin

Then I did again:

git fetch 

So I can work on that branch but it gives back the result/error as above.

Someone has some advice?

回答1:

  1. Make sure the user run the git fetch has the write permission to your local repository.
  2. Please check if there is a file called "192RestService" under refs/remotes/origin/tryYourself/
  3. Try to remove the file "192RestService", then check the gitfetch again.


标签: git tfs cmd branch