Last active 1725560370

create an opengist via shell

Revision 85b0625a7b851cfb31396dca3461fe0f11e02066

opengist Raw
1#! /bin/sh
2
3# create an opengist file and push it to the server
4#
5# alexlehm/at/gmail.com
6
7TMPDIR=git.gist.$$
8
9if [ `expr "$1" : "https://"` = 0 ]
10then
11 URL=https://alexlehm@gist.tilde.green/init
12 mkdir $TMPDIR
13else
14 URL=$1
15 shift
16 git clone $URL $TMPDIR
17fi
18
19if [ $# = 0 ]
20then
21 cat >$TMPDIR/file.txt
22else
23 cp $* $TMPDIR/
24fi
25
26cd $TMPDIR
27git init
28git config credential.helper store
29git add .
30git commit -m "automatic upload"
31# if default branch is main, change to master, otherwise we confuse opengist
32git branch master
33git checkout master
34git remote add origin $URL
35git push -u origin master
36
37cd ..
38rm -rf $TMPDIR/
39
40
opengist.sh Raw
1#! /bin/sh
2
3# create an opengist file and push it to the server
4#
5# alexlehm/at/gmail.com
6
7TMP=git.gist.$$
8
9mkdir $TMP
10
11cp $1 $TMP/
12
13cd $TMP
14git init
15git config credential.helper store
16git add .
17git commit -m "automatic upload"
18# if default branch is main, change to master, otherwise we confuse opengist
19git branch master
20git checkout master
21git remote add origin https://alexlehm@gist.tilde.green/init
22git push -u origin master
23
24cd ..
25rm -rf $TMP
26