mkdir test
cd test
## https://gist.github.com/mainiak/5419663
git clone --mirror [email protected]:5419663.git
cd 5419663.git
git update-server-info
mv objects/pack/*.pack ./
git unpack-objects < *.pack
rm -f *.pack objects/pack/*
## in 5419663.git
cd ..
#ipfs add --progress --pin=true --cid-version 1 --recursive 5419663.git
initial_cid=$(ipfs add -q --pin=true --cid-version 1 -r 5419663.git | tail -n 1 | tr -s ':blank:')
echo "# Initial CID: ${initial_cid}"
## Just to be sure
ipfs pin add -r --progress /ipfs/${initial_cid}
## Make pinned files visible in IPFS Desktop
#ipfs files cp /ipfs/bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574 "/5419663.git"
ipfs files cp /ipfs/${initial_cid} "/5419663v2.git"
## Cleanup
#rm -rf 5419663.git
Outcome CID: bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574
CID Info: base32 - cidv1 - dag-pb - sha2-256~256~C30DA740438FC0AD0AD8A33EE0C8D1FF732DDFA0C6A0E28DBE6C13224E627DFF
(UnixFS)
## Create new Peer/Node ID/key
ipfs key gen 5419663-git
peer_id=$(ipfs key list -l | fgrep 5419663-git | cut -f1 -d' ')
echo "# Peer ID: ${peer_id}"
#> ipfs name publish --key=5419663-git /ipfs/bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574
> ipfs name publish --key=5419663-git /ipfs/${initial_cid}
Published to k51qzi5uqu5dgc3bchx1ns43pwuj9mhq2d1h1dhc1wni0hc4y9yz28fkajt8xj: /ipfs/bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574
libp2p-key CID Info
Notes:
- I assume this might disappear with my IPFS node shut down (??)
- It seems that with DHT, IPFS (Kubo) re-uploads IPNS records every 4 hours. Otherwise they would expire after 24 hours
- ... takes a while (??)
Setup with your DNS provider
## 5419663-git.example.com
#5419663-git.example.com CNAME ipfs.cloudflare.com. # paid??
#5419663-git.example.com CNAME ipfs.io. # supported??
#_dnslink.5419663-git.example.com TXT "dnslink=/ipfs/bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574"
_dnslink.5419663-git.example.com TXT "dnslink=/ipns/<__PEER_ID__>"
Note:
- Should result in IPFS URL like
5419663--git-example-com.ipns.<IPFS GW>
and/ipns/5419663-git.example.com
. - You can test by putting
5419663-git.example.com
into Durin app. - You can also try directly
ifps://bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574
in your browser and it should open IPFS Desktop. - You can also try directly
ipns://k51qzi5uqu5dgc3bchx1ns43pwuj9mhq2d1h1dhc1wni0hc4y9yz28fkajt8xj
in your browser and it should open IPFS Desktop. - You can also try directly
ipns://5419663-git.example.com
in your browser and it should open IPFS Desktop.
## Doesn't work
#git clone http://5419663-git.example.com 5419663
## Ensure we have Git remote helper (IPLD)
go install github.com/ipfs-shipyard/git-remote-ipld/cmd/git-remote-ipld@latest
which git-remote-ipld
## Git clone (w/ IPLD helper) ... doesn't really work (?!)
git clone ipld://bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574 5419663_ipld
## Ensure we have Git remote helper (IPFS)
go install github.com/cryptix/git-remote-ipfs@latest
which git-remote-ipfs
## Git clone (w/ IPFS helper)
git clone ipfs://ipfs/bafybeigdbwtuaq4pycwqvwfdh3qmrup7omw57iggudri3ptmcmre4yt574 5419663_ipfs
## Will NOT work
#git clone ipns://5419663-git.example.com 5419663_ipns
#git clone ipfs://ipns/5419663-git.example.com
and ultimate test ...
# edit vimrc.md
git commit -am 'changes'
#git push #nope
new_cid=$(cat 5419663_ipfs/.git/config | fgrep ipfs | cut -f5 -d '/')
echo "# New CID: ${new_cid}"
## Just to be sure
ipfs pin add -r --progress /ipfs/${new_cid}
## Update
ipfs name publish --key=5419663-git /ipfs/${new_cid}
... which worked, except DNSLink is hardcoded to specific CID, so shows old version instead of new one bafybeidj5kp6qzc4m2u7aq44nmvg46gtbsfz6alilaispjjvh2ssnw7iaa
.
Not sure if we can solve that with DNSLink pointing to IPNS and then we just "git-push overwrite" the thing ??
## Show Peer IDs (used by IPNS)
ipfs key list -l
## Confirm local pins
ipfs pin ls --type=all
## Confirm DNSLink entry
dig +noall +answer TXT \_dnslink.5419663-git.example.com
## Remove CID v0 objects
ipfs pin rm --recursive QmZwbbuwPWNh9DFveTEFGnvQAz1oxkizX3J5TSta5f8k3F
- Rewrite above steps to Go lang app/tool (??)
- IGiS as application igis.io and as demo repository, doesn't seem to work.
- https://docs.ipfs.tech/how-to/publish-ipns/#publishing-ipns-names-with-kubo
- https://docs.ipfs.tech/concepts/dnslink/#publish-content-path
- https://dnslink.dev/
- https://docs.ipfs.tech/how-to/host-git-repo/
- https://github.com/cryptix/git-remote-ipfs (217 stars) ... works!!
- https://github.com/ipfs-shipyard/git-remote-ipld (135 stars) .. nope!!
- https://github.com/dhappy/git-remote-ipfs (50 stars) ... JS (?!)
- https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols
- https://git-scm.com/book/en/v2/Git-on-the-Server-Getting-Git-on-a-Server
- https://git-scm.com/book/en/v2/Git-on-the-Server-Git-Daemon
- https://git-scm.com/book/en/v2/Git-on-the-Server-Smart-HTTP
- https://git-scm.com/book/en/v2/Git-on-the-Server-GitWeb
- https://git-scm.com/docs/git-shell