Created
November 24, 2025 16:56
-
-
Save angeloevangelista/a54dbcdf7117e3f1c5e861fadbac0405 to your computer and use it in GitHub Desktop.
Adjust files permissions on git repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env zsh | |
| for FOLDER in *(/); do | |
| if [[ -d "$FOLDER/.git" ]]; then | |
| cd "$FOLDER" || continue | |
| MODIFIED_FILES=("${(@f)$(git ls-files -m)}") | |
| if (( ${#MODIFIED_FILES[@]} > 0 )); then | |
| echo "Applying chmod 644 in $FOLDER" | |
| chmod 644 -- "${MODIFIED_FILES[@]}" | |
| fi | |
| cd - >/dev/null || exit | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment