1

I recently had to move to a new laptop. As part of that process, I copied all of my Visual Studio projects (hosted on Visual Studio Team Services, previously VS Online (VSO), using git as the version control) to a large hard drive so that I wouldn't have to individually clone each one from Team Services.

When I added one of the projects to SourceTree as a working copy, SourceTree sees all of the files as changed, and some of them as needing to be added. It seems to only see the master branch, whereas I was on the develop branch on the old machine. I get a similar result in Git UI.

Trying to do a fetch fails with

 error: inflate: data stream error (unknown compression method) error: unable to unpack 7ec327f34038debcc33b63a865c98405aaa49f7b header fatal: SHA1 COLLISION FOUND WITH 7ec327f34038debcc33b63a865c98405aaa49f7b ! fatal: index-pack failed 

I have a fair number of repos, and it would be nice if I didn't have to download each one from Team Services and could just use the copied files. But I don't know what I need to do to get git to "see" these repos correctly.

2
  • Possible duplicate stackoverflow.com/questions/23964033/… Commented Aug 11, 2016 at 22:20
  • I hope not, since the accepted answer is what I am trying to avoid doing and the other answer did not work. Commented Aug 11, 2016 at 22:44

1 Answer 1

2

I think you had a corruption in the copy. Because a copy should work without problem!

For me the best way to copy a git repository is to do:

  • commit all the changes
  • delete All the files in the working directory (to hugely speedup the copy). But be careful to absolutely keep the '.git' folder!
  • run 'git gc' (that creates big pack files quick to copy)
  • copy the repository
  • in the new repository, run git reset --hard to restore the content of the working directory (that's quite quick)

That's more reliable and fast!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks :). I actually was getting an error when I tried to do some of the things in the "possible duplicate" referenced above, and I just deleted the file that was causing the error. That fixed the problem.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.