I've cloned Git repository with files stored in local ipfs, I've initialized ipfs special remote, however I cannot download files stored in there.
I've run: git annex copy --from ipfs as suggested in this page, but the files aren't downloaded. It's like git-annex doesn't see them there.
Here is my setup (this part works):
I've local IPFS Deamon running (
ipfs init; ipfs daemon).I've installed Git Annex (Apt/Brew install git-annex).
Installed ipfs remote script (as per git-annex/special remotes/ipfs page):
mkdir -v ~/bin wget -O ~/bin/git-annex-remote-ipfs https://git-annex.branchable.com/special_remotes/external/git-annex-remote-ipfs export PATH="$PATH:$HOME/bin"I've created a new repo (
mkdir test01 && cd test01 && git init).I've committed a regular file (
touch README.md; git add README.md; git commit -m'Initial commit' README.md).I've initialized git-annex (
git annex init).I've initialized annex remote (
git annex initremote ipfs type=external externaltype=ipfs encryption=none).I've committed ipfs file (
echo test > ipfs-file.txt; git annex add ipfs-file.txt; git commit -m'Adds ipfs file' ipfs-file.txt).Copied to local ipfs object store (
git annex copy --to ipfs).Synchronize local repository with remotes (
git annex sync ipfs). I'm not sure if this is needed.I've confirmed file is at ipfs having ipfs address with CID assigned (
git annex whereis ipfs-file.txt).git annex listoutputsX__X ipfs-file.txtadditionally confirming the file is at ipfs storage.
Cloning into new repo and downloading files from ipfs (this part doesn't work):
- Created another empty repo (
mkdir ../test02 && cd ../test02 && git init). - Pulled files from the previous repo (
git pull ../test01). - Now
ipfs-file.txtis a symbolic link to non-existing file (ls -la ipfs-file.txt). - I've initialized git-annex in the new repo (
git annex init). - I've initialized annex remote (
git annex initremote ipfs type=external externaltype=ipfs encryption=none). - Enabled ipfs remote (
git annex enableremote ipfs). I don't think it's needed. - I did sync (
git annex sync ipfs). I'm not sure if this is needed. - I've run:
git annex copy --from ipfs, this doesn't do anything. I expect it to copy the files from ipfs remote.
I've run the following commands:
% git annex whereis ipfs-file.txt
whereis ipfs-file.txt (0 copies) failed
whereis: 1 failed
% git annex list
here
|web
||bittorrent
|||ipfs
||||
____ ipfs-file.txt
which suggest the file isn't present at ipfs remote (missing X), however it was in the 1st repository.
I've run git annex copy --from ipfs -d (with debug), but git-annex-remote-ipfs script
isn't even called like it does on --to ipfs.
As a workaround, you could use
git annex whereisto look up the ipfs address of the file in the original repository (test01) to obtain the IPFS CID for the file.Then, in the new repository (test02), use the
git annex registerurlcommand with the obtained IPFS CID.That should allow you to run
git annex copy --from ipfsin the new repository (test02) and download the file.