Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"No such file or directory": problem with gitbash in Windows 10 #2

Open
stevenkkim opened this issue Jun 15, 2018 · 8 comments

Comments

@stevenkkim
Copy link

commented Jun 15, 2018

I'm using vs code on Windows 10, but I'm using gitbash as my integrated terminal instead of the Windows shell.

When using either the "Open in Integrated Terminal" or "Open Root in Integrated Terminal" commands, the directory is not found because the directory slashes are backslashes (Windows-style) instead of forward slashes (bash-style)

Upon opening the terminal, the following output is shown:

cd c:\Users\Steven\Dev\selenium.js
bash: cd: c:UsersStevenDevselenium.js: No such file or directory

If I type manually type "cd c:/Users/Steven/Dev/selenium.js" in the integrated terminal, then the cd command works.

@stevenkkim

This comment has been minimized.

Copy link
Author

commented Jun 15, 2018

FYI, it looks like the extension terminal-here (https://marketplace.visualstudio.com/items?itemName=Tyriar.vscode-terminal-here) works in gitbash in the integrated terminal on Windows. If you look at the code here:

https://github.com/Tyriar/vscode-terminal-here/blob/master/src/extension.ts

the relevant code is this:

        switch(kindOfShell(vscode.workspace.getConfiguration('terminal'))) {
            case "wslbash":
                // c:\workspace\foo to /mnt/c/workspace/foo
                dir = dir.replace(/(\w):/, '/mnt/$1').replace(/\\/g, '/')
                break;
            case "cmd":
                // send 1st two characters (drive letter and colon) to the terminal
                // so that drive letter is updated before running cd
                terminal.sendText(dir.slice(0,2));
        }

        terminal.sendText(`cd "${dir}"`);
@stevenkkim

This comment has been minimized.

Copy link
Author

commented Jun 15, 2018

Sorry, I just noticed one more thing... when I use the terminal-here extension, the terminal command says:

cd "c:\Users\Steven\Dev\selenium.js"

which works with the backslashes. So fixing this bug may be as simple as enclosing the directory path in double quotes.

@fabiospampinato fabiospampinato added the bug label Jun 15, 2018

@fabiospampinato

This comment has been minimized.

Copy link
Owner

commented Jun 15, 2018

Thanks for reporting the issue, I don't really use Windows nor git bash so I'm not too surprised to see these incompatibilities. I'll address the problem when I'll have the time.

Ps. I think you should use a "real" terminal instead, like bash or zsh, running under WSL.

@stevenkkim

This comment has been minimized.

Copy link
Author

commented Jun 16, 2018

Thanks Fabio. I did try WSL a while ago when it first came out, but there were too many bugs at the time. Also, sharing files between the Windows filesystem and Linux subsystem was a pain. It's possible to symlink Linux to Windows, but not vice versa. But maybe they have fixed those issues since. Git bash, while not "real bash" does a surprisingly good job emulating bash on Windows and is very lightweight. It's the best terminal shell on Windows in my opinion. WSL and Cygwin were too heavy and complicated. And I certainly don't want to learn Powershell.

@fabiospampinato

This comment has been minimized.

Copy link
Owner

commented Jan 10, 2019

I'm sorry but I didn't have the time to try to fix this, if anyone could help with this I'd appreciate it.

@neelam0026

This comment has been minimized.

Copy link

commented May 30, 2019

@stevenkkim I am facing the same issue as you have and I am new user for this github so kindly help regarding the same issue faced by me

@neelam0026

This comment has been minimized.

Copy link

commented May 30, 2019

Issue : "No such file or directory": problem with gitbash in Windows 10 #2 if you find the solutions for it please let me know.

@ahull002

This comment has been minimized.

Copy link

commented Aug 5, 2019

Sorry, I just noticed one more thing... when I use the terminal-here extension, the terminal command says:

cd "c:\Users\Steven\Dev\selenium.js"

which works with the backslashes. So fixing this bug may be as simple as enclosing the directory path in double quotes.

Hi, this also worked for me as well: wrapping the dir in double-quotes somehow worked! Thank you so much for your help!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.