Skip to content

Unable to launch venv for pre-commit from GutHubDesktop #19520

@Nniol

Description

@Nniol

The problem

Hi,
I have a pre-commit hook and it works from the command line if I do
git add file1.py
git add file2.py
git commit -m "a message"

however if I run it from the desktop I get

Activating virtual environment...
.git/hooks/pre-commit: line 5: C:/Work/GitHubRepo/WatsonX/pilots/FK/orchestration/venv_fk_watsonx/Scripts/activate: No such file or directory
Failed to activate virtual environment. Commit aborted.

This is the same if Use the /c/Work path too

#!/bin/bash

echo "Activating virtual environment..."
#source /c/Work/GitHubRepo/WatsonX/pilots/FK/orchestration/venv_fk_watsonx/Scripts/activate
source C:/Work/GitHubRepo/WatsonX/pilots/FK/orchestration/venv_fk_watsonx/Scripts/activate

if [ $? -ne 0 ]; then
    echo "Failed to activate virtual environment. Commit aborted."
    exit 1
fi

echo "Running pybabel command as a pre-commit hook..."
pybabel init -D prompt -i locales/sv/prompt.pot -o locales/sv/LC_MESSAGES/prompt.po -l en -w 130
pybabel init -D prompt -i locales/en/prompt.pot -o locales/en/LC_MESSAGES/prompt.po -l en -w 130


if [ $? -ne 0 ]; then
    echo "pybabel command failed! Commit aborted."
    exit 1
fi

echo "Adding to commit"
git add locales/sv/LC_MESSAGES/prompt.po
git add locales/en/LC_MESSAGES/prompt.po

echo "pybabel command executed successfully. Proceeding with commit..."
exit 0

Release version

Version 3.4.8 (x64)

Operating system

Windows 11

Steps to reproduce the behavior

Use the pre-commit and it fails

Log files

No response

Screenshots

image

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions