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.

Esther Fan - MSFT
  • 8,276
  • 4
  • 27
  • 25
Amy Blankenship
  • 6,485
  • 2
  • 22
  • 45

1 Answers1

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!

Philippe
  • 28,207
  • 6
  • 54
  • 78
  • 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. – Amy Blankenship Aug 11 '16 at 22:59