andy-5 / wslgit

Use Git installed in Bash on Windows/Windows Subsystem for Linux (WSL) from Windows and Visual Studio Code (VSCode)
MIT License
1.18k stars 59 forks source link

How do you install `wslgit`? #140

Open worldofgeese opened 8 months ago

worldofgeese commented 8 months ago

It isn't clear from the README.

I installed wslgit using scoop install wslgit. I could have also fetched the release binary from GitHub and put it in my Windows PATH (<- this bit was assumed since it isn't stated in the docs).

Whether I've installed it with scoop or manually fetched the binary, at this point I'm told to run install.bat but no matter where I source it, the response from the script is

Create 'git.exe' symlink...
The system cannot find the path specified.
OK.

git.exe is on my PATH and invokable.

I'm sure everything is obvious but the README assumes a lot of knowledge here. I'd appreciate some clarity!

andy-5 commented 8 months ago

Depending on your use case, an installation might not be necessary.

If you just want to use git from the command line, and already have the binary in some directory on your PATH, you can already use it. You may rename wslgit.exe to git.exe so you can just run git … on the command line (otherwise you had to run wslgit ...).

The install.bat script is just required to create a directory structure similar to Git for Windows, so that some tools are able to auto-detect the "installed" Git. If you want/need this, unzip wslgit.zip from the releases page into some directory on your PATH, and run install.bat as administrator from that directory. I don’t know how this is handled with the scoop distribution, as I do not maintain that myself (I think it only provides wslgit.exe, and not the directory structure, or install.bat).

Your error seems to indicate that the install.bat is not located in a directory structure as found in wslgit.zip, and therefore cannot find the necessary files.

Does this help you?

However, you wrote that git.exe is already invokable, so it seems you can already use it? What is missing, or does not work?

worldofgeese commented 8 months ago

@andy-5 I'm using Fork's latest WSL build so I need install.bat to run successfully. I pieced together how to get this to work based on other issues. Basically, it's my fault for picking the wslgit binary over the wslgit.zip on the releases page. It's the zipfile that contains the directory structure install.bat expects. That wasn't clear to me.

I scripted this:

# Download wslgit.zip using Invoke-WebRequest
Invoke-WebRequest -Uri "https://github.com/andy-5/wslgit/releases/download/v1.2.0/wslgit.zip" -OutFile "C:\wslgit.zip"

# Extract wslgit.zip to C:\
Expand-Archive -Path "C:\wslgit.zip" -DestinationPath "C:\"

# Add C:\wslgit\cmd to the system PATH
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\wslgit\cmd", "Machine")

# Optionally, if you want to clean up and remove the downloaded zip after extraction:
Remove-Item -Path "C:\wslgit.zip"
C:\wslgit\install.bat

Would you be open to a PR to the README that steps through this setup?

andy-5 commented 8 months ago

Sure, any improvements are welcome.

On Fri, Oct 20, 2023 at 12:42 PM Tao @.***> wrote:

@andy-5 https://github.com/andy-5 I'm using Fork's latest WSL build so I need install.bat to run successfully. I pieced together how to get this to work based on other issues. Basically, it comes down to picking the wslgit binary over the wslgit.zip on the releases page. It's the zipfile that contains the directory structure install.bat expects. That wasn't clear to me.

I scripted this:

Download wslgit.zip using Invoke-WebRequest

sudo Invoke-WebRequest -Uri "https://github.com/andy-5/wslgit/releases/download/v1.2.0/wslgit.zip" -OutFile "C:\wslgit.zip"

Extract wslgit.zip to C:\

sudo Expand-Archive -Path "C:\wslgit.zip" -DestinationPath "C:\"

Add C:\wslgit\cmd to the system PATH

sudo [Environment]::SetEnvironmentVariable("Path", $env:Path + ";C:\wslgit\cmd", "Machine")

Optionally, if you want to clean up and remove the downloaded zip after extraction:

sudo sudo Remove-Item -Path "C:\wslgit.zip" sudo C:\wslgit\install.bat

Would you be open to a PR to the README that steps through this setup?

— Reply to this email directly, view it on GitHub https://github.com/andy-5/wslgit/issues/140#issuecomment-1772507777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAS46ATXRUOQCDYV6FS7LXDYAJIRJAVCNFSM6AAAAAA6DVADKGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZSGUYDONZXG4 . You are receiving this because you were mentioned.Message ID: @.***>

lostpebble commented 4 months ago

Was also quite confused about how to set this up. I see mention of an install.bat file in the Readme- but nothing inside releases but a zip file and an .exe (which I assume the zip file contains). But actually the install.bat is also inside the zip file.