Skip to content

Instantly share code, notes, and snippets.

View carlolars's full-sized avatar

Carl-Oskar Larsson carlolars

  • Stockholm, Sweden
View GitHub Profile
@carlolars
carlolars / gitkraken-wsl-bash.bat
Last active February 10, 2023 21:08
Use bash from WSL as sh.exe for GitKraken (5.0.4) for Windows
@echo off
REM Make sure that the path to the script is correct!
@bash -l -c "~/bin/gitkraken-wsl-bash.sh %*"
@carlolars
carlolars / git-serve.md
Created April 22, 2019 12:45
Yet another git-serve alias.
[alias]
    serve = "!f(){ printf \"Starting git-daemon for $(pwd) @ 'git://$(hostname)/$(basename $(pwd))'.\nExample: git clone git://$(hostname)/$(basename $(pwd)) [<directory>]\n\"; git daemon --base-path=.. --reuseaddr --informative-errors --verbose --export-all ../$(basename $(pwd)) ; }; f"

Most serve aliases I've seen exports the current directory using itself as base path, which anonymizes the actual repository beeing shared (git://<addr>) unless sharing the parent directory which cause all repositories there to become exported.

This alias exports the current directory using the parent directory as base so the repository URL will be like
git://<addr>/my-repo.
It also prints the URL that can be used to access the exported repository when the daemon starts.

@carlolars
carlolars / .wsl-git.md
Last active October 29, 2024 07:25
HOWTO: Use WSL and its Git in a mixed development environment

How to setup a development environment where Git from WSL integrates with native Windows applications, using the Windows home folder as the WSL home and using Git from WSL for all tools.

Note if using Git for Windows, or any tool on the Windows side that does not use Git from WSL then there will likely be problems with file permissions if using those files from inside WSL.

Tools

These are the tools I use:

  • git (wsl) - Command line git from within WSL.
  • Fork (windows) - Git GUI (must be used with wslgit)
  • wslgit - Makes git from WSL available for Windows applications. Important! Follow the installation instructions and do (at least) the first optional step and then the Usage in Fork instructions.