#! /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 cd $TMPDIR git init git config credential.helper store # if default branch is main, change to master, otherwise we confuse opengist git remote add origin $URL cd .. if [ $# = 0 ] then cat >$TMPDIR/file.txt else cp $* $TMPDIR/ fi cd $TMPDIR git add . git commit -a -m "automatic upload" git branch master git checkout master git push -u origin master cd .. else URL=$1 shift git clone $URL $TMPDIR if [ $# = 0 ] then cat >$TMPDIR/file.txt else cp $* $TMPDIR/ fi cd $TMPDIR git commit -a -m "automatic upload" cd .. fi rm -rf $TMPDIR/