Skip to content

Instantly share code, notes, and snippets.

@angeloevangelista
Created November 24, 2025 16:56
Show Gist options
  • Select an option

  • Save angeloevangelista/a54dbcdf7117e3f1c5e861fadbac0405 to your computer and use it in GitHub Desktop.

Select an option

Save angeloevangelista/a54dbcdf7117e3f1c5e861fadbac0405 to your computer and use it in GitHub Desktop.
Adjust files permissions on git repositories
#!/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