Error when checking out a branch in SourceTree for Windows

Kevin Jett March 18, 2013

When checking out a branch in SourceTree for Windows I get this error:

git -c diff.mnemonicprefix=false -c core.quotepath=false checkout master
Switched to branch 'master'


git -c diff.mnemonicprefix=false -c core.quotepath=false submodule update --init --recursive
bash.exe: warning: could not find /tmp, please create!

/libexec/git-core/git-sh-setup: line 266: cd: .git: No such file or directory

Unable to determine absolute path of git directory

Completed with errors, see above.

It still checks-out the branch but it gives this error everytime. It also gives me this error when I try to stash something but it will not let me stash anything when I get this error.

6 answers

1 accepted

2 votes
Answer accepted
Kevin Jett March 23, 2013

It looks like my instance of git that is installed has some variables set incorrectly that SourceTree uses. I went to settings and changed SourceTree to use the embedded version of git and it's working now.

0 votes
André Hänsel June 13, 2013

I had exactly the same problem (message complaining about HOME, submodules not working) with the embedded version. I don't know if related, but external conflict resolving didn't work either.

I had to kill sh.exe, then delete git_local and then redownload the embedded git (just renaming it and redownloading did not help).

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 13, 2013

That sounds like it didn't extract properly for some reason the first time. Were there any permission errors when you were trying to delete git_local?

André Hänsel June 13, 2013

I couldn't delete git_local because it was in use (by sh.exe, of course) but I still could rename it (Windows is strange). After killing sh.exe I could delete it without problems.

But the problem started totally unprovoked, I didn't do any update updates or the like. SourceTree doesn't automatically update the embedded Git, does it?

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 13, 2013

Nope, only when you click 'Update Embedded Git' in Tools > Options > Git. Very odd.

0 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2013

Hmm, I don't have HOME explicitly set either although I do have the Windows standard ones HOMEDRIVE (C:) and HOMEPATH (\Users\Steve). If HOME isn't defined then Git Bash will usually define HOME based on those two. Is your environment missing HOMEDRIVE and HOMEPATH?

0 votes
Kevin Jett March 19, 2013

I don't have submodules but I do have more info. I tried to clone another repository and got this message:

git -c diff.mnemonicprefix=false -c core.quotepath=false clone --recursive https://user@bitbucket.org/account/repo.git "C:\Users\User1\Documents\repo"
Cloning into 'C:\Users\User1\Documents\repo'...

bash.exe: warning: could not find /tmp, please create!

/libexec/git-core/git-sh-setup: line 266: cd: .git: No such file or directory

Unable to determine absolute path of git directory

Completed with errors, see above.

I also went to another repository and opened the terminal from SourceTree and it had error messages too:

base.exe: warning: could not find /tmp, please create!

ERROR: HOME directory 'C:\Users\User1' doesn't exist!

This is an error which might be related to msysGit issue 108.
You might want to set the environment variable HOME explicitly.

Falling back to / (C:/Program Files (x86)/Git).

0 votes
Paul Peavyhouse March 19, 2013

If I may piggy-back on this question for a moment, my project has nested submodules and I am still trying to figure out how much submodule support the current SourceTree for Windows has.
Your FAQs states: "Submodule support isn't 100% yet; they should keep in sync but you can't configure them and some subtleties won't be dealt with yet"

I don't see any hint of my submodules in a repo that I imported from using in TortoiseGit.
I am expecting the same "Submodules" node under the "Remotes" and "Stashes" nodes.

I cloned a fresh copy of the repo and do see it checking out submodules, but again I don't see any "Submodules" node.

stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 19, 2013

Right now under the hood SourceTree for Windows does the minimum necessary to co-exist with submodules; so when you clone a repo with submodules it will use --recursive to clone them too, it will also show when you change the submodule tracked commit and will let you stage & commit that change, but there is no explicit UI representation of the submodules in the sidebar tree, nor can you create or manipulate the submodule configuration. This is all coming and will mirror the Mac version when it's done.

0 votes
stevestreeting
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 18, 2013

This might be related to submodules which we don't fully support in the Windows version yet, but I have a repo with a submodule here as a compatability test and I don't see this error when I switch branches. Can you check if your submodules are configured correctly?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events