Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

pre-push hook does not run #422

Closed
jastkand opened this issue Mar 24, 2016 · 1 comment
Closed

pre-push hook does not run #422

jastkand opened this issue Mar 24, 2016 · 1 comment
Labels

Comments

@jastkand
Copy link

I have a simple pre-push hook in my repo which looks this way

#!/bin/sh

# .git/hooks/pre-push

while read local_ref local_sha remote_ref remote_sha
do
  echo $local_ref
  if [ "$local_ref" = "refs/heads/master" ]
  then
    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    echo " You cannot push to master! It's locked "
    echo "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
    exit 1
  fi
done
exit 0

It works fine if I run it using console git push origin master or git push. It also works if I try to push using SourceTree. But it does not run when I try to push using git atom. Can anybody tell me why this can happen?


Atom: 1.6.0
git-plus: 5.13.0

@akonwi
Copy link
Owner

akonwi commented Nov 1, 2016

I'm sorry that this has been unanswered for so long.

The package tries to do a regular push and if that fails, we assume it is because the current branch doesn't track a remote branch so we try again with git push --set-upstream [remote branch] HEAD.

I think a good solution here is to remove the retry logic and provide an option to push with the -u flag

@akonwi akonwi added the bug label Nov 1, 2016
@akonwi akonwi closed this as completed in 009ff2b Nov 1, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants