sync: 2026-09-28 19:29
This commit is contained in:
1 parent
0751ca592d
commit
9c13ae7a65
3 files changed
+26
-8
No files matched your search
@@ -1,3 +1,4 @@
|
||||
[submodule "DEV1.1/TP"]
|
||||
path = DEV1.1/TP
|
||||
url = gitea@grond.iut-fbleau.fr:vincentg/DEV.git
|
||||
branch = main
|
||||
+1
-1
Submodule DEV1.1/TP updated: b99aa0392b...70a3078428.
@@ -1,33 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Set PATH so cron can find git, date, ssh, etc.
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin:$PATH"
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin"
|
||||
|
||||
# Explicitly set target directory (don't rely on $HOME in cron)
|
||||
TARGET_DIR="/home/benji/Documents/COURS"
|
||||
|
||||
# SSH key pour Git (appliquée à la fois à Homelab et IUT)
|
||||
export GIT_SSH_COMMAND="ssh -i /home/benji/.ssh/git -o IdentitiesOnly=yes"
|
||||
|
||||
# Navigate to target directory
|
||||
cd "$TARGET_DIR" || {
|
||||
echo "Directory not found"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Pull remote changes rebase-style
|
||||
# 1. Pull remote changes (repo principal + sous-modules)
|
||||
git pull --rebase --autostash || {
|
||||
echo "Git pull failed"
|
||||
echo "Git pull failed on COURS"
|
||||
exit 1
|
||||
}
|
||||
git submodule update --remote --merge || {
|
||||
echo "Git submodule update failed"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Stage all files
|
||||
# 2. Traitement du sous-module TP (Gitea IUT)
|
||||
if [ -d "DEV1.1/TP" ]; then
|
||||
cd DEV1.1/TP
|
||||
git add -A
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
git commit -m "sync: $(date +'%Y-%m-%d %H:%M')"
|
||||
git push || echo "Avertissement : Git push à échoué sur le sous-module TP"
|
||||
fi
|
||||
cd "$TARGET_DIR" || exit 1
|
||||
fi
|
||||
|
||||
# 3. Traitement du dépôt principal COURS (Gitea Homelab)
|
||||
git add -A
|
||||
|
||||
# Commit only if there are actual changes staged
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
git commit -m "sync: $(date +'%Y-%m-%d %H:%M')"
|
||||
git push || {
|
||||
echo "Git push failed"
|
||||
echo "Git push failed on COURS"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
echo "No changes to commit."
|
||||
echo "No changes to commit in COURS."
|
||||
fi
|
||||
Reference in new issue
Block a user