#! /bin/sh # create an opengist file and push it to the server # # alexlehm/at/gmail.com TMPDIR=git.gist.$$ if [ `expr "$1" : "https://"` = 0 ] then URL=https://alexlehm@gist.tilde.green/init mkdir $TMPDIR else URL=$1 shift git clone $URL $TMPDIR fi if [ $# = 0 ] then cat >$TMPDIR/file.txt else cp $* $TMPDIR/ fi cd $TMPDIR git init git config credential.helper store git add . git commit -m "automatic upload" # if default branch is main, change to master, otherwise we confuse opengist git branch master git checkout master git remote add origin $URL git push -u origin master cd .. rm -rf $TMPDIR/