Skip to content

Instantly share code, notes, and snippets.

@EscApp2
Created June 19, 2026 14:53
Show Gist options
  • Select an option

  • Save EscApp2/ec6337e53c19b62487c26d474a4d515c to your computer and use it in GitHub Desktop.

Select an option

Save EscApp2/ec6337e53c19b62487c26d474a4d515c to your computer and use it in GitHub Desktop.
change rights after git
.git/hooks/post-merge
#!/bin/bash
TARGET_DIR="XXXXXXXXXXXXXX"
echo "[post-merge] Updating permissions and ownership in $TARGET_DIR"
echo "[post-merge] Excluding some directories"
find "$TARGET_DIR" \
\( -path "$TARGET_DIR/.git" \
-o -path "$TARGET_DIR/.well-known" \
-o -path "$TARGET_DIR/bitrix" \
-o -path "$TARGET_DIR/upload" \
-prune -o -type f -exec chmod 644 -- {} + -exec chown bitrix:bitrix -- {} +
find "$TARGET_DIR" \
\( -path "$TARGET_DIR/.git" \
-o -path "$TARGET_DIR/.well-known" \
-o -path "$TARGET_DIR/bitrix" \
-o -path "$TARGET_DIR/upload" \
-prune -o -type d -exec chmod 755 -- {} + -exec chown bitrix:bitrix -- {} +
echo "[post-merge] Permissions and ownership updated"
1)Ошибка:
fatal: cannot exec '.git/hooks/post-merge': No such file or directory
Команда
file .git/hooks/post-merge
Если ответ содержит " with CRLF line terminators"
исполнить sed -i 's/\r$//' .git/hooks/post-merge
2)Ошибка
The '.git/hooks/post-merge' hook was ignored because it's not set as executable.
Исполнить
chmod +x .git/hooks/post-merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment