Git clone writable: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
   if [ $1 = "clone" ]; then
   if [ $1 = "clone" ]; then
     # Might work.
     # Might work.
     #find . -iname .git* -perm u-w -exec chmod u+w {} \+;
     #sudo find . -iname .git* -perm u-w -exec chmod u+w {} \+;
     command git "$@" && chmod -R u+w */.git*;
     command git "$@" && chmod -R u+w */.git*;
     # You may prefer.
     # You may prefer.
     #command git "$@" && rm -fR */.git*;
     #command git "$@" && rm -fR */.git*;
    # Uncomment section to SlackBuilds.org version naming convention compress.
    #d='$@' #d=https://github.com/user/project.git;
    #d=${d##*/} 
    #d=${d%.git}
    #cd $d
    #VERSION=$(git log --pretty=format:'%cd_%h' --date=format:'%Y%m%d' | head -n 1)
    #cd ..
    #tar --exclude-vcs -cJvf $d-$VERSION.tar.xz $d
   else
   else
     command git "$@";
     command git "$@";

Revision as of 05:18, 27 July 2022

# bash function: set git clones user-writable (annoyingly if you clone some files are non-user-writable... dangerously tempts 'sudo rm -rf'!)
git()
{
  if [ $1 = "clone" ]; then
    # Might work.
    #sudo find . -iname .git* -perm u-w -exec chmod u+w {} \+;
    command git "$@" && chmod -R u+w */.git*;
    # You may prefer.
    #command git "$@" && rm -fR */.git*;
    # Uncomment section to SlackBuilds.org version naming convention compress.
    #d='$@' #d=https://github.com/user/project.git;
    #d=${d##*/}  
    #d=${d%.git}
    #cd $d
    #VERSION=$(git log --pretty=format:'%cd_%h' --date=format:'%Y%m%d' | head -n 1)
    #cd ..
    #tar --exclude-vcs -cJvf $d-$VERSION.tar.xz $d
  else
    command git "$@";
  fi;
}