Skip to content

Instantly share code, notes, and snippets.

@singpolyma
Last active October 1, 2017 22:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save singpolyma/3429712f64b998f5b4fc37e2f3f2816d to your computer and use it in GitHub Desktop.
Save singpolyma/3429712f64b998f5b4fc37e2f3f2816d to your computer and use it in GitHub Desktop.
git-ipfs
#!/bin/sh
set -e
TMP="$(mktemp -d)"
git clone -q --bare . "$TMP"
cd "$TMP"
git update-server-info
if [ objects/pack/*.pack != 'objects/pack/*.pack' ]; then
cat objects/pack/*.pack | git unpack-objects
rm -f objects/pack/*
fi
HASH="$(ipfs add -Qr .)"
rm -rf "$TMP"
if [ -n "$1" ]; then
ipfs name publish --key=$1 "/ipfs/$HASH"
else
echo "$HASH"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment