Cmder: git stash

Created on 22 Mar 2016  Â·  11Comments  Â·  Source: cmderdev/cmder

I get the following error when running git stash:

λ git stash list
fatal: C:\tools\cmder\vendor\git-for-windows\mingw32/libexec/git-core\git-stash cannot be used without a working tree.

d:\Documents\SpaceFloepers

d:\Documents\SpaceFloepers is my working directory, and contains the repository. Git stash works correctly when using git for windows bash prompt.

Most helpful comment

The same happened on my machine. It turned out, that "git stash" worked while running in classic cmd.exe, so I disabled "ConEmu -> Settings -> Features -> Inject ConEmuHk". Now it works fine.

All 11 comments

Been a problem for me a long time now. So frustrated that git stash won't work

This works just fine for me. Are you having problems with other git commands, or only stash? What output does this give you:

git rev-parse --is-inside-work-tree

(Might also be relevant what version of cmder / git you are using.)

I am meeting the same problem too.

"git submodule" throw the same error.

but it is ok when i use git bash or windows cmd.

git rev-parse --is-inside-work-tree

this returns "true"

λ git rev-parse --is-inside-work-tree
returns "true"

cmder version: v1.2.9, git version 2.7.4.windows.1

There are more git commands which give the same error, unfortunately I cannot remember which in particular.

On Wed, Apr 6, 2016 at 8:58 PM, Greg Lucas [email protected] wrote:

This works just fine for me. Are you having problems with other git
commands, or only stash? What output does this give you:

git rev-parse --is-inside-work-tree

—
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
https://github.com/cmderdev/cmder/issues/894#issuecomment-206513660

I too cannot execute "git stash" or "git submodule" and some other commands as well

I'm having this issue as well.

In my git-for-windows install the string "cannot be used without a working tree" occurs in two places, in the git-sh-setup script under cmder/vendor/(etc). It's either a result of calling

git rev-parse --is-inside-work-tree 2>/dev/null

which should be true, or

git rev-parse --is-bare-repository

which should be false.

Looks like git-stash sources git-sh-setup and then calls require_work_tree, which is the first case listed above.

For the folks having problems, does it make a difference if you try the git command from a cmd.exe shell vs a bash shell? I'm guessing this is always a cmd.exe problem?

I'm currently running cmder v.1.3.0-pre with a cmd.exe shell and cannot reproduce this problem with either git 2.7.4.windows.1 or 2.8.0.windows.1.

I can confirm the problem occurs in require_work_tree when executing git stash.
The problem occurs with both cmd.exe and bash, but not with Git Bash as distributed with git for windows.

Sorry for the late reply btw.

The same happened on my machine. It turned out, that "git stash" worked while running in classic cmd.exe, so I disabled "ConEmu -> Settings -> Features -> Inject ConEmuHk". Now it works fine.

Had this problem with git mergetool but @chrisseroka s solution fixed it.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zsedcbm picture zsedcbm  Â·  3Comments

GlassGruber picture GlassGruber  Â·  3Comments

danwellman picture danwellman  Â·  3Comments

giuliannosbrugnera picture giuliannosbrugnera  Â·  3Comments

luisrudge picture luisrudge  Â·  3Comments