Git clone writable: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:
{
{
   if [ $1 = "clone" ]; then
   if [ $1 = "clone" ]; then
     command git "$@" && find */.git -type f -perm ! -u=w -exec chmod u+w {} \;
     command git "$@" && find */.git -perm u-w -exec chmod u+w "{}" \;
   else
   else
     command git "$@";
     command git "$@";

Revision as of 03:16, 19 June 2020

#Bash function to make git clones writable (annoyingly, if you clone repository, some files are non-user-writable... which after compiling dangerously tempts 'sudo rm -rf!')
git()
{
  if [ $1 = "clone" ]; then
    command git "$@" && find */.git -perm u-w -exec chmod u+w "{}" \;
  else
    command git "$@";
  fi;
}