wslgit icon indicating copy to clipboard operation
wslgit copied to clipboard

'git --version' produces a fatal result

Open LancerTony opened this issue 4 years ago • 2 comments

Following the instructions on this page to use the WSL git. However, running the git or git --version command on Windows Command Prompt produces the following result:

/mnt/d/DevLib/wslgit-master/wslgit.sh: line 83: cd: C:\Users\tony1: No such file or directory
fatal: can not cd to C:\Users\tony1 (C:\Users\tony1)

mount -t drvfs returns nothing and /etc/wsl.conf has the following:

# [network]
# generateResolvConf = false    

My current Windows version:

Windows 10 Version 2004 
Build 19041.172

Surely there must be something I am missing yes?

LancerTony avatar Apr 02 '20 15:04 LancerTony

I have updated wslgit.dev.sh a little. First of all mount -t drvfs => return nothing to, it happened after update to 2004. So I have updated wslgit.dev.sh file.

function get_mounted_drvfs() {
	mount -t 9p | "$AWK" '
	function trim(s) { gsub(/^[ \t]+/, "", s); gsub(/[ \t]+$/, "", s); return s; }
	{
		if(split($0, lr, "type 9p") < 2) next;
		if(split(lr[1], part, "on") < 2) next;

		drive = trim(substr(part[1],1,2));
		mount_to = trim(part[2]);

		print toupper(drive) "\n" mount_to;
	}';
	# endregion need-to-be-replaced-in-unit-test
}

changed all places with drvfs => 9p. And now it works for me. After that, generate new wslgit.sh and change old one.

edwardhura avatar May 27 '20 14:05 edwardhura

The fix above that @edwardhura posted worked for me. It wasn't entirely obvious how to generate a new wslgit.sh at first, this is done by runnings ./scripts/gen-wslgit-sh.sh.

hyllus avatar Jun 08 '20 20:06 hyllus