Can't re-clone a repo in Sourcetree
Asked by chris.oneill:

I have a rather small repo, hosting on a gitlab server. Through a series of unfortunate events, I messed up my local version of the repo trying to commit and push changes that were fairly inconsequential. Rather than bother fixing that merge conflict, I opted to delete my local repo and clone it again. That's where the problems started...

Cloning into '/Users/chris/myreponame'...

warning: templates not found /usr/local/git/share/git-core/templates

fatal: The remote end hung up unexpectedly

fatal: early EOF

fatal: index-pack failed

I can't seem to get around this. I've rebooted, updated and reinstalled Sourcetree, tried cloning into various different folders on my local machine, same error each time. Others are able to clone the repo fresh into a new location, and have had no issues pulling, committing, or pushing into this repo. It certainly seems to be a local problem on my machine. Short of formatting OSX and reinstalling my operating system, i'm out of ideas here. I've found a few posts around the internet from people getting the same error message, but there's never an answer for the problem. Posting here in hopes of getting a hint! :smile:


Answers:
author: Bal?zs Szakm?ry
body: I think your problem is not with SourceTree. The key part is "The remote end hung up unexpectedly." Since you say that others can access the repo correctly, it is also probably not a server problem.

The two main possibilities:

* Something wrong with your Git installation ("warning: templates not found /usr/local/git/share/git-core/templates" points in this direction; reinstall Git to make sure it has all the bits and pieces.)
* Local firewall settings make Git unable to reach the server.

comments: author: chris.oneill
body: Well that was at least an interesting rabbit hole! My Sourcetree was set, I believe by default, to use Embedded Git. I switched it to use System Git, but had the same error occur. So I went and downloaded git-2.2.1-intel-universal-mavericks.dmg file. Followed the readme instructions, ran an uninstall.sh script first, installed git, and ran another script to setup the git path for non-terminal programs. Rebooted my mac and in the terminal did a "git --version" which is still showing "git version 1.9.3 (Apple Git-50)" rather than the newer git version, 2.2.1... So am I presuming the uninstall.sh script did not find the proper version of Git to uninstall?

edit: I did manage to get Sourcetree to recognize the newer version of Git eventually. Now it's showing 2.2.1 in the stree UI, but same damn error message. Others in the office here are on the same network as myself, I can't see it being a firewall issue. Still lost!


author: chris.oneill
body: I discovered that the repo folder was actually still sitting in my OSX trash. Running out of time to fix this, I just restored the folder and that will have to do! Presumably Sourcetree/Git was still referencing the version of the repo that was in the Trash?


author: Bal?zs Szakm?ry
body: Not sure how the trash works in OSX, but it might be that it was using it from there. Is it solved now?


author: chris.oneill
body: Well it's solved in that I gave up trying to re-clone. :) I still think it's probably a bug in SourceTree, if it's still holding on to references for things that have been deleted in the filesystem, but I'll have to do more testing on that sometime and submit a proper bug report. Thanks for the help!