Skip to content

Instantly share code, notes, and snippets.

@sonywork
Forked from putermancer/gist:847755
Created November 13, 2017 17:22
Show Gist options
  • Save sonywork/8ca100c86d2e4ddb6bbb7977519e8d3a to your computer and use it in GitHub Desktop.
Save sonywork/8ca100c86d2e4ddb6bbb7977519e8d3a to your computer and use it in GitHub Desktop.

Revisions

  1. @putermancer putermancer revised this gist Mar 4, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ elif [[ $1 == "SET_ENV_ONLY" ]]; then
    # if there is at least one non-git command, source this file in a new shell and create the 'gitolite' function
    else
    /bin/bash -c "source $0 shiftme SET_ENV_ONLY; $*"
    fi
    fi
  2. @putermancer putermancer revised this gist Mar 1, 2011. 1 changed file with 10 additions and 6 deletions.
    16 changes: 10 additions & 6 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,21 @@
    #!/bin/bash
    shift # get rid of -c

    # if no commands, just open a shell
    if [[ $# -eq 0 ]]; then
    echo "No params"
    /bin/bash -l

    # if the first arg is a git- command, that means it is something like git-push, etc... so forward it
    elif [[ $1 == git-* ]]; then
    echo "git command"
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
    ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*

    # if the first arg is SET_ENV_ONLY, we sourced this file in order to set up the gitolite function
    elif [[ $1 == "SET_ENV_ONLY" ]]; then
    echo "set the magicks"
    gitolite () {
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
    ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
    }

    # if there is at least one non-git command, source this file in a new shell and create the 'gitolite' function
    else
    echo "source the bugger ($0)"
    /bin/bash -c "source $0 shiftme SET_ENV_ONLY; $*"
    fi
  3. @putermancer putermancer revised this gist Mar 1, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -5,11 +5,11 @@ if [[ $# -eq 0 ]]; then
    /bin/bash -l
    elif [[ $1 == git-* ]]; then
    echo "git command"
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $1
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
    elif [[ $1 == "SET_ENV_ONLY" ]]; then
    echo "set the magicks"
    gitolite () {
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $1
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $*
    }
    else
    echo "source the bugger ($0)"
  4. @putermancer putermancer revised this gist Mar 1, 2011. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -13,5 +13,5 @@ elif [[ $1 == "SET_ENV_ONLY" ]]; then
    }
    else
    echo "source the bugger ($0)"
    /bin/bash -c "source $0 SET_ENV_ONLY; $*"
    fi
    /bin/bash -c "source $0 shiftme SET_ENV_ONLY; $*"
    fi
  5. @putermancer putermancer revised this gist Mar 1, 2011. 1 changed file with 13 additions and 10 deletions.
    23 changes: 13 additions & 10 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,17 @@
    #!/bin/bash
    shift # get rid of -c
    if [[ $# -gt 0 && $1 == git* ]]; then
    GIT_COMMAND=$1
    shift
    if [[ $GIT_COMMAND == gitolite* ]]; then
    GIT_COMMAND=${GIT_COMMAND#gitolite}
    fi
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $GIT_COMMAND $*
    elif [[ $# -gt 0 ]]; then
    $*
    else
    if [[ $# -eq 0 ]]; then
    echo "No params"
    /bin/bash -l
    elif [[ $1 == git-* ]]; then
    echo "git command"
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $1
    elif [[ $1 == "SET_ENV_ONLY" ]]; then
    echo "set the magicks"
    gitolite () {
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $1
    }
    else
    echo "source the bugger ($0)"
    /bin/bash -c "source $0 SET_ENV_ONLY; $*"
    fi
  6. @putermancer putermancer revised this gist Feb 28, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ if [[ $# -gt 0 && $1 == git* ]]; then
    if [[ $GIT_COMMAND == gitolite* ]]; then
    GIT_COMMAND=${GIT_COMMAND#gitolite}
    fi
    ssh git@localhost $GIT_COMMAND $*
    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no git@localhost $GIT_COMMAND $*
    elif [[ $# -gt 0 ]]; then
    $*
    else
  7. @putermancer putermancer revised this gist Feb 28, 2011. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -6,7 +6,7 @@ if [[ $# -gt 0 && $1 == git* ]]; then
    if [[ $GIT_COMMAND == gitolite* ]]; then
    GIT_COMMAND=${GIT_COMMAND#gitolite}
    fi
    ssh git@git.af1.movenetworks.com $GIT_COMMAND $*
    ssh git@localhost $GIT_COMMAND $*
    elif [[ $# -gt 0 ]]; then
    $*
    else
  8. @putermancer putermancer created this gist Feb 28, 2011.
    14 changes: 14 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    #!/bin/bash
    shift # get rid of -c
    if [[ $# -gt 0 && $1 == git* ]]; then
    GIT_COMMAND=$1
    shift
    if [[ $GIT_COMMAND == gitolite* ]]; then
    GIT_COMMAND=${GIT_COMMAND#gitolite}
    fi
    ssh [email protected] $GIT_COMMAND $*
    elif [[ $# -gt 0 ]]; then
    $*
    else
    /bin/bash -l
    fi