Skip to content

Instantly share code, notes, and snippets.

@7-zete-7
Last active November 21, 2023 23:38
Show Gist options
  • Save 7-zete-7/c8a217700f88d43ef29c940a6ef9d7f1 to your computer and use it in GitHub Desktop.
Save 7-zete-7/c8a217700f88d43ef29c940a6ef9d7f1 to your computer and use it in GitHub Desktop.
Фикс для git, запускаемого на WSL2, для PhpStorm
  1. Создать файл /usr/local/bin/git-wsl и записать в него содержимое файла git-wsl.sh из этого gist'а.

  2. Сделать созданный файл исполяемым

# chmod +x /usr/local/bin/git-wsl
  1. Настроить PhpStorm для запуска созданного файла вместо стандартного бинарника git (Version Control → Git → Path to Git executable)

image

Вместо <distributive_name> необходимо указать наименование используемого WSL.

  1. Проверить корректность работы кликом по кнопке Test напротив поля Path to Git executable.
#!/bin/sh
/usr/bin/git "$@"
STATUS=$?
for SOCKET in $(find /run/WSL/ -maxdepth 1 -type s -mmin +1 -name *_interop); do
if ! ss -elx | grep -q "$SOCKET"; then
rm "$SOCKET"
fi
done
exit "$STATUS"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment