google-labs-jules[bot] commited on
Commit
a7a6a0f
·
1 Parent(s): 311adc3

Add pre-push hook to sync to Hugging Face Space

Browse files

This commit adds a `pre-push` hook in the `githooks` directory.
The hook automatically pushes the `main` branch to the `hf` remote
whenever a push is performed, provided the `hf` remote exists.
It includes a check to prevent infinite recursion when pushing to `hf`.

To enable this hook, run:
git config core.hooksPath githooks

Files changed (1) hide show
  1. githooks/pre-push +19 -0
githooks/pre-push ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+
3
+ remote="$1"
4
+ url="$2"
5
+
6
+ # Avoid infinite recursion if the push is already to 'hf'
7
+ if [ "$remote" = "hf" ]; then
8
+ exit 0
9
+ fi
10
+
11
+ # Check if 'hf' remote exists
12
+ if git remote | grep -q "^hf$"; then
13
+ echo "Pushing to Hugging Face Space..."
14
+ git push hf main
15
+ else
16
+ echo "Remote 'hf' not found. Skipping push to Hugging Face Space."
17
+ fi
18
+
19
+ exit 0