Sourcetree fails to open repository after converting it from hg -> git

I've started converting my projects from hg -> git - which works all fine. Except that SourceTree complains about not finding a .hg directoy in the git project.

I tried deleting the bookmarks - which worked for the main repository but not for the sub repositories.

It seems that Sourcetree somewhere stores a cache bound to the path of the project. How can I delete this? (MacOS)

5 answers

1 accepted

Actually, the bug report might not be necessary. There's a couple of things here. Firstly, we can't expect SourceTree to know a repository has been converted on-the-fly. It's added as a hg/git repo, so SourceTree will assume that's what it is. You'd have to re-add it. The second point is that submodules are handled differently between each repo type. In git it's in a .gitmodules file and in hg it's in a .hgsub file.

You'd have to figure out what tool you're using is doing to the repository's submodules configuration, this isn't really down to us. In your case you need to ensure there's a valid .gitmodules file in your repo (ls -a in the terminal for that folder). If there isn't, then you'd need to create it and mimic the configuration you previously had in the .hgsub file.

I'll close the JIRA issue I created as this is a conversion issue rather than a SourceTree issue.

Feel free to fire me more questions relating to it.

EDIT: Here's a link which may help

Hi Andreas,

When you say SourceTree is complaining, could you be more specific? Does it allow you to re-add the project back to the bookmarks at all?

One thing to check would be to see if your project folder has the necessary hidden folders for SourceTree to determine the repo type. Within the repository folder if you browse to it through the terminal and hit "ls -a" in your case it should show a ".git" directory and ".hg" shouldn't exist at all. Could you clarify this is the case?

When you say sub-repositories, are you referring to a repository that's in a folder in the bookmarks folder?


moved to comment - see above

A way to reproduce the problem on Mac is

mkdir sourcetreetest

cd sourcetreetest

echo "hello" > readme.txt

hg init

hg addremove

hg commit -m "readme"


When SourceTree opens add repository to the bookmarks. The title bar reads "sourcetreetest (Mercurial)". You see the working copy and the default branch and the commit.

Close Sourcetree.

Back to bash:

rm -rf .hg

git init

git add *

git commit -a -m "readme"


The title bar still reads "sourcetreetest (Mercurial)". The repository is unreadable. Workingcopy only shows a spinning icon.

It seems that this can be fixed by deleting the bookmark.

However if you have subrepositories in Mercurial and after converting the project to git use submodules in the same place deleting the bookmark does not seem to suffice.

Hi Andreas,

I've raised a bug report in JIRA for this one. Editing the browser.plist file would most likely fix this issue which is located in ~/Library/Application Support/SourceTree/browser.plist (make sure you always back it up first before editing it). This isn't a solution, just a workaround in the meantime. You may need to delete any relative submodules out to that entry in this XML file that could be affecting it. Check the bug report for more details and add yourself as a watcher, I'll be working on it from today as you've rightly pointed out how it gets affected with submodules.

Hope that helps

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,205 views 4 2
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you