Skip to content

Instantly share code, notes, and snippets.

Avatar

Carl-Oskar Larsson carlolars

  • Stockholm, Sweden
View GitHub Profile
@carlolars
carlolars / gitkraken-wsl-bash.bat
Last active Mar 16, 2021
Use bash from WSL as sh.exe for GitKraken (5.0.4) for Windows
View gitkraken-wsl-bash.bat
@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 Apr 22, 2019
Yet another git-serve alias.
View git-serve.md
[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 May 16, 2021
HOWTO: Use WSL and its Git in a mixed development environment
View .wsl-git.md

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 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.