Skip to content

[Bug]: Push fails due to global hooks #1055

@rlobrecht

Description

@rlobrecht

Describe the bug

On MacOS, Obsidian Version 1.12.4 (Installer 1.12.4), plugin version 2.38.0, git version 2.50.1 (Apple Git-155)

I get the following error when the plugin issues a push:

plugin:obsidian-git:414 obsidian-git: Pushing....
plugin:obsidian-git:414 obsidian-git: Error: Pushing to ssh://redacted/pkg/Rlobrech_obsidian_vault
git: 'defender' is not a git command. See 'git --help'.
error: failed to push some refs to 'ssh://redacted/pkg/Rlobrech_obsidian_vault'

    at Object.action (plugin:obsidian-git:155:11264)
    at Tz.exec (plugin:obsidian-git:155:11760)
    at eval (plugin:obsidian-git:154:6943)
    at new Promise (<anonymous>)
    at c0.handleTaskData (plugin:obsidian-git:154:6832)
    at c0.attemptRemoteTask (plugin:obsidian-git:154:6488)
    at async c0.attemptTask (plugin:obsidian-git:154:5970)
displayError @ plugin:obsidian-git:414

My /etc/gitconfig is

[core]
	hooksPath = /usr/local/amazon/var/git-defender/hooks
[defender]
	registered = false

The folder /usr/local/amazon/var/git-defender/hooks contains a bunch of executable files
applypatch-msg post-merge pre-merge-commit
code-defender-daemon post-rewrite pre-push
commit-msg post-update pre-rebase
post-applypatch pre-applypatch prepare-commit-msg
post-checkout pre-auto-gc push-to-checkout
post-commit pre-commit sendemail-validate

git push origin at the command line works fine.

Relevant errors (if available) from notifications or console (CTRL+SHIFT+I)

plugin:obsidian-git:414 obsidian-git: Pushing....
plugin:obsidian-git:414 obsidian-git: Error: Pushing to ssh://redacted/pkg/Rlobrech_obsidian_vault
git: 'defender' is not a git command. See 'git --help'.
error: failed to push some refs to 'ssh://redacted/pkg/Rlobrech_obsidian_vault'

    at Object.action (plugin:obsidian-git:155:11264)
    at Tz.exec (plugin:obsidian-git:155:11760)
    at eval (plugin:obsidian-git:154:6943)
    at new Promise (<anonymous>)
    at c0.handleTaskData (plugin:obsidian-git:154:6832)
    at c0.attemptRemoteTask (plugin:obsidian-git:154:6488)
    at async c0.attemptTask (plugin:obsidian-git:154:5970)
displayError @ plugin:obsidian-git:414

Steps to reproduce

Execute Git: Commit-and-sync or Git: Push

Expected Behavior

No error and Push completed

Addition context

No response

Operating system

macOS

Installation Method

None

Plugin version

2.38.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions