Skip to content

Provide a way for git hooks to know whether they're being run from Github Desktop #19001

@patreeceeo

Description

@patreeceeo

The feature request

I would like to have a way for my git hook scripts to know if they're being run from Github Desktop, as opposed to another interface e.g. running git from the command line.

My motivation is that I have found certain activities in my pre-commit hook cause Github Desktop to become unresponsive. I'll open a separate issue about this once I understand better what's going on, but for now I would like to be able to exit the commit if these activities need to be run and the hook is being run via Github Desktop.

Proposed solution

Set an shell environmental variable, such as:

export GIT_INTERFACE="GithubDesktop"

I don't know enough about the internals of Github Desktop to give much more detail here, but from briefly looking at the source code, this might actually require feature request for dugite?

Anyway, wherever/however the git binary is being executed, would it be possible to just set an environment variable beforehand?

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