Say I’ve got a website running on IPFS and I change a single file. Re-adding does not seem to update the file (tried hard-cache-clearing refresh). The hash is the same, so… I even tried IPFS rm hash
, which did remove it, but when re-adding, the same hash was output (would have guessed slightly differently because content was slightly different) and website appears to be the same.
So what is the IPFS way of updating one of many files in a directory?
This sounds a bit weird. When I change a file in a directory, that file’s IPFS hash will be different, when I add it to the IPFS, same with the parent hash (the directory’s hash). I always run ipfs pin rm
on both the previous file’s hash and the directory’s old hash, then I run ipfs add
on the new file and the whole directory, then ipfs pin add
on both. (Don’t know if the pin add
command is necessary, but I do it just to be sure.) At any rate, if you access the website on localhost using the new parent hash, it should then show the new version.
For the record, ipfs add ...
pins by default, unless you use ipfs add --pin=false ...
, so the ipfs pin add
after adding is unneccesary.
2 Likes