-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to publish a deck into anki? #173
Comments
(would this be better as a discussion? it looks like that GitHub feature is not turned on for this repo) |
Thanks for commenting :) No this is quite fine as an issue! Okay so first things first: you should use the simplest workflow that will work for your use case. If all you want to do is use Alice's shared collection/deck, then just export it within Anki and then have Bob import it. Done. You should only need to use Ki if both users plan to continuously push and pull from the collection and it is infeasible for them to use the same AnkiWeb account. As for what Bob needs to do to track some kind of remote deck within his collection, perhaps this example is best to look at: Lines 25 to 55 in eb32fbd
This is a workflow to create a new remote subdeck on github or some other remote. If you already have one set up, then I believe instead of running Then you can follow the example above for merging and pushing. Apologies the docs are quite outdated and don't reflect this 😅 If you're using this seriously for a while I'll go in and update them at some point, but at the moment I don't have any users, so it's not a big priority. |
Ugh, GitHub didn't let me know there was a response. Since we're in active study, I expect the deck(s) to grow, so Alice would be continuing to add more definitions/terms in, and Bob would want to have the updates synced in (running a manual command to do this is fine). I had contemplated running an instance of https://hub.docker.com/r/matb/docker-anki-sync-server but I started getting the impression that ankiweb and anski-sync-server are intended for single use and not so much "Alice is publishing, Bob is pulling, anyone else can pull if they want".... (very new to anki, just decided it was time for my study tools to be FOSS, so still figuring it all out) So...., |
Please do
…________________________________
From: MakerByNight ***@***.***>
Sent: Wednesday, July 31, 2024 1:55:08 PM
To: langfield/ki ***@***.***>
Cc: langfield ***@***.***>; Comment ***@***.***>
Subject: Re: [langfield/ki] How to publish a deck into anki? (Issue #173)
Ugh, GitHub didn't let me know there was a response. Since we're in active study, I expect the deck(s) to grow, so Alice would be continuing to add more definitions/terms in, and Bob would want to have the updates synced in (running a manual
Ugh, GitHub didn't let me know there was a response.
Since we're in active study, I expect the deck(s) to grow, so Alice would be continuing to add more definitions/terms in, and Bob would want to have the updates synced in (running a manual command to do this is fine).
I had contemplated running an instance of https://hub.docker.com/r/matb/docker-anki-sync-server<https://urldefense.com/v3/__https://hub.docker.com/r/matb/docker-anki-sync-server__;!!KGKeukY!w42os-5Y8YX1i9vg6pAbsddFGYe0sAlagpY6YHHN366TWljr-1oP4BTblcdmyXJ6xP8rd3wOIjnR_P2u04UyYw7vyuXS4Q$> but I started getting the impression that ankiweb and anski-sync-server are intended for single use and not so much "Alice is publishing, Bob is pulling, anyone else can pull if they want"....
(very new to anki, just decided it was time for my study tools to be FOSS, so still figuring it all out)
So....,
with regular updates, and wanting to "publicize" the decks on GitHub (instead of sharing ankiweb credentials), I think the subtree makes the most sense.
I'll give that a test tonight and report back.
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/langfield/ki/issues/173*issuecomment-2261056216__;Iw!!KGKeukY!w42os-5Y8YX1i9vg6pAbsddFGYe0sAlagpY6YHHN366TWljr-1oP4BTblcdmyXJ6xP8rd3wOIjnR_P2u04UyYw4UoBPYnw$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AISQNI6ZL5NJSRDNY3NWN5TZPEQHZAVCNFSM6AAAAABK3ELDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRRGA2TMMRRGY__;!!KGKeukY!w42os-5Y8YX1i9vg6pAbsddFGYe0sAlagpY6YHHN366TWljr-1oP4BTblcdmyXJ6xP8rd3wOIjnR_P2u04UyYw5RbNcTeg$>.
You are receiving this because you commented.Message ID: ***@***.***>
|
I'm apparently very confused on how git subtrees is supposed to work... I think I've deduced that I can't really work at a "sub-collection" level, and it needs to be individual decks. Ok. After adding a bunch of quotes into params in the copy of # setup a local repo to push into
mkdir /tmp/osi_model
pushd /tmp/osi_model/
git init --bare
popd
subdeck "Achronyms/" /tmp/osi_model -f And tha seemed to work (or at least didn't error) subdeck "Achronyms/" https://github.com/mshafer1/anki__ccna__osi_model.git Which pushed all the decks... ... Looking at it, I see that "achronyms" is a subtree.... So then I made a new repo and manually copied/commited just the relevant files into it: then in my "second profile" test repo I wound up whiping the deck and running that from my first-profile as well to force it to be a subtree. I then went into Anki and added a term, ..., ... and... What exactly is |
@mshafer1 Apologies for the late reply! You've picked up the workflow pretty well given the lamentable lack of documentation, I'm impressed 😄 I'm unsure what you mean by "sub-collection", but yes, you need to specify a deck. Of course it can be a top-level deck that includes your entire collection or any subset, so this should be sufficiently flexible for anyone's needs.
Ah, that is a problem. I have quite explicitly dropped compatibility with Windows. However if you're using As for the deck not getting filtered properly, try running each command in the Line 12 in eb32fbd
Let me know what the output looks like, because it appears you've done most everything else correctly. The
|
Well, I didn't get a chance to test this last night, and tonight will be busy as well, but I'll plan to try it out tomorrow and report back. |
Ah my bad! Yes please let me know, @mshafer1! 🙂 |
@mshafer1 Any luck? |
Been hectic here this last week. Hoping to work on this by Monday evening at the latest. |
doing a ki clone for a fresh look
switch to Git Bash to run subdeck# note, since I messed with the installed copy, I grabbed a source copy of subdeck
# and only added a "set -o verbose" for echoing commands out
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_2/collection_clone/collection (main)
$ ls
Achronyms/ Definitions/ 'Network Topologies'/ 'Subnet Classes'/ 'WAN types'/ _media/ ccna_achronyms/ models.json
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_2/collection_clone/collection (main)
$ subdeck-verbose Achronyms https://github.com/mshafer1/test-ki-achronyms2.git
set -e
subdeck=$(echo "$1" | sed 's,/*$,,')
remote=$2
root=$(git rev-parse --show-toplevel)
rm -rf /tmp/ki
mkdir -p /tmp/ki
cd /tmp/ki
git clone $root $subdeck
Cloning into 'Achronyms'...
done.
cd $subdeck
git subtree split --prefix $subdeck --annotate="($subdeck) " --rejoin
Added dir 'Achronyms'
4471d69c3f127900c4f6bb965b3f8a93290a7d2e
cd $(git rev-parse --show-toplevel)
git remote rm origin
git remote add origin $remote
mkdir -p .github/workflows
cp $root/.github/workflows/jekyll-gh-pages.yml.example .github/workflows/jekyll-gh-pages.yml
git add .github
git commit -m "Add github pages CI workflow"
[main e6a2b8f] Add github pages CI workflow
1 file changed, 53 insertions(+)
create mode 100644 .github/workflows/jekyll-gh-pages.yml
git push -u origin main
Enumerating objects: 49, done.
Counting objects: 100% (49/49), done.
Delta compression using up to 4 threads
Compressing objects: 100% (43/43), done.
Writing objects: 100% (49/49), 8.62 KiB | 551.00 KiB/s, done.
Total 49 (delta 2), reused 0 (delta 0), pack-reused 0 (from 0)
remote: Resolving deltas: 100% (2/2), done.
To https://github.com/mshafer1/test-ki-achronyms2.git
* [new branch] main -> main
branch 'main' set up to track 'origin/main'.
cd $root
git rm -r $subdeck
rm 'Achronyms/models.json'
git commit -m "Remove \`$subdeck\`"
[main d479776] Remove `Achronyms`
1 file changed, 1 deletion(-)
delete mode 100644 Achronyms/models.json
rm -rf $subdeck
echo "Just deleted prefix"
Just deleted prefix
git subtree add --prefix $subdeck $remote main
git fetch https://github.com/mshafer1/test-ki-achronyms2.git main
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 6 (delta 1), reused 5 (delta 0), pack-reused 0 (from 0)
Unpacking objects: 100% (6/6), 770 bytes | 15.00 KiB/s, done.
From https://github.com/mshafer1/test-ki-achronyms2
* branch main -> FETCH_HEAD
Added dir 'Achronyms'
echo "commits for deck '$subdeck' pushed to '$remote'"
commits for deck 'Achronyms' pushed to 'https://github.com/mshafer1/test-ki-achronyms2.git' |
@mshafer1 Well it looked like it ran without any issues. Are you still seeing any unexpected behavior? |
Maybe I'm not expecting correctly? It cloned the full repo to the "dest', did I misunderstand that it was supposed to turn a folder into a sub-tree and push it? |
I see! Can you post the output of ls before and after the git subtree split command? No need to run anything after that.
…________________________________
From: MakerByNight ***@***.***>
Sent: Tuesday, August 20, 2024 11:19:26 PM
To: langfield/ki ***@***.***>
Cc: langfield ***@***.***>; Comment ***@***.***>
Subject: Re: [langfield/ki] How to publish a deck into anki? (Issue #173)
Maybe I'm not expecting correctly? It cloned the full repo to the "dest', did I misunderstand that it was supposed to turn a folder into a sub-tree and push it? — Reply to this email directly, view it on GitHub, or unsubscribe. You are
Maybe I'm not expecting correctly?
It cloned the full repo to the "dest', did I misunderstand that it was supposed to turn a folder into a sub-tree and push it?
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/langfield/ki/issues/173*issuecomment-2300510513__;Iw!!KGKeukY!wOWMuWZ-IS0Jqi_-yzHuL3zQUrr51o9SMBYKvYGJauFwHPgMrbBspPg3B8KayuDtomAHhMDicWYUscLRFC-CGTdw_E5O1A$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AISQNI5XLOPW5ZPVBGUKPO3ZSQBL5AVCNFSM6AAAAABK3ELDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBQGUYTANJRGM__;!!KGKeukY!wOWMuWZ-IS0Jqi_-yzHuL3zQUrr51o9SMBYKvYGJauFwHPgMrbBspPg3B8KayuDtomAHhMDicWYUscLRFC-CGTfJIZAedA$>.
You are receiving this because you commented.Message ID: ***@***.***>
|
(setup with a completely fresh Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ subdeck-verbose Achronyms https://github.com/mshafer1/test-ki-achronyms3.git
set -e
subdeck=$(echo "$1" | sed 's,/*$,,')
remote=$2
root=$(git rev-parse --show-toplevel)
rm -rf /tmp/ki
mkdir -p /tmp/ki
cd /tmp/ki
git clone $root $subdeck
Cloning into 'Achronyms'...
done.
cd $subdeck
ls
Achronyms Definitions 'Network Topologies' 'Subnet Classes' 'WAN types' ccna_achronyms models.json netmasks
git subtree split --prefix $subdeck --annotate="($subdeck) " --rejoin
Added dir 'Achronyms'
1c28a7bdda887ca436373e1bfc7a08af4409422f
ls
Achronyms Definitions 'Network Topologies' 'Subnet Classes' 'WAN types' ccna_achronyms models.json netmasks
exit 0
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ ls -al
total 46
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 ./
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 ../
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 .git/
-rw-r--r-- 1 Admin 197121 26 Aug 24 07:59 .gitattributes
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 .github/
-rw-r--r-- 1 Admin 197121 13 Aug 24 07:59 .gitignore
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 .ki/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 Achronyms/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 Definitions/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 'Network Topologies'/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 'Subnet Classes'/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 'WAN types'/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 _media/
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 ccna_achronyms/
-rw-r--r-- 1 Admin 197121 13880 Aug 24 07:59 models.json
drwxr-xr-x 1 Admin 197121 0 Aug 24 07:59 netmasks/
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ nano /c/Users/Admin/.local/bin/subdeck-verbose
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ cd Achronyms/
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection/Achronyms (main)
$ git status
On branch main
nothing to commit, working tree clean
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection/Achronyms (main)
$ git remote -v
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection/Achronyms (main)
$ cd ..
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ git log Achronyms/
commit 593258f499e91ae2b6b4fc9f335c3bea1fb47509 (HEAD -> main, tag: last-successful-ki-push)
Author: mshafer1 <[email protected]>
Date: Sat Aug 24 07:59:04 2024 -0500
Initial commit
Admin@Matthew-Laptop2 MINGW64 ~/Documents/GitHub/ki_working_dir_3/collection (main)
$ git log Definitions/
commit 593258f499e91ae2b6b4fc9f335c3bea1fb47509 (HEAD -> main, tag: last-successful-ki-push)
Author: mshafer1 <[email protected]>
Date: Sat Aug 24 07:59:04 2024 -0500
Initial commit |
Playing with this a little bit and reading the sub-tree man page... Is it conceivable that this line: https://github.com/langfield/ki/blob/eb32fbd3229dc1a60bcc76a937ad63f3eb869f65/subdeck#L15C1-L15C30 should be doing a subtree push instead of a push?? |
Also confirmed that behavior is the same between Git Bash and WSL |
I believe something is going wrong with git subtree split. Only the directory in question should remain after that command. (And indeed this is the behavior I see on my machine.) Can you print out the local branches before and after and see if they differ?
…________________________________
From: MakerByNight ***@***.***>
Sent: Saturday, August 24, 2024 9:30:28 AM
To: langfield/ki ***@***.***>
Cc: langfield ***@***.***>; Comment ***@***.***>
Subject: Re: [langfield/ki] How to publish a deck into anki? (Issue #173)
Also confirmed that behavior is the same between Git Bash and WSL — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented. Message ID: <langfield/ki/issues/173/2308396264@ github. com>
Also confirmed that behavior is the same between Git Bash and WSL
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/langfield/ki/issues/173*issuecomment-2308396264__;Iw!!KGKeukY!3b9KmFa7y3f3eqxtrypbfIWKZ6TH6zv_Z7_XSV7VLxq6CJdlviAFaT7qomPh_gYr-8iLXcjYBJU5ikhd0mwUWNkO2-rZ3A$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AISQNI2OYIWFBRZTMUP5HOLZTCDHJAVCNFSM6AAAAABK3ELDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGM4TMMRWGQ__;!!KGKeukY!3b9KmFa7y3f3eqxtrypbfIWKZ6TH6zv_Z7_XSV7VLxq6CJdlviAFaT7qomPh_gYr-8iLXcjYBJU5ikhd0mwUWNnh2eYpAg$>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Apologies that this isn't working out of the box!
…________________________________
From: Whitaker, Brendan T. ***@***.***>
Sent: Saturday, August 24, 2024 9:56:55 AM
To: langfield/ki ***@***.***>
Subject: Re: [langfield/ki] How to publish a deck into anki? (Issue #173)
I believe something is going wrong with git subtree split. Only the directory in question should remain after that command. (And indeed this is the behavior I see on my machine.) Can you print out the local branches before and after and see if they differ?
________________________________
From: MakerByNight ***@***.***>
Sent: Saturday, August 24, 2024 9:30:28 AM
To: langfield/ki ***@***.***>
Cc: langfield ***@***.***>; Comment ***@***.***>
Subject: Re: [langfield/ki] How to publish a deck into anki? (Issue #173)
Also confirmed that behavior is the same between Git Bash and WSL — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented. Message ID: <langfield/ki/issues/173/2308396264@ github. com>
Also confirmed that behavior is the same between Git Bash and WSL
—
Reply to this email directly, view it on GitHub<https://urldefense.com/v3/__https://github.com/langfield/ki/issues/173*issuecomment-2308396264__;Iw!!KGKeukY!3b9KmFa7y3f3eqxtrypbfIWKZ6TH6zv_Z7_XSV7VLxq6CJdlviAFaT7qomPh_gYr-8iLXcjYBJU5ikhd0mwUWNkO2-rZ3A$>, or unsubscribe<https://urldefense.com/v3/__https://github.com/notifications/unsubscribe-auth/AISQNI2OYIWFBRZTMUP5HOLZTCDHJAVCNFSM6AAAAABK3ELDTWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBYGM4TMMRWGQ__;!!KGKeukY!3b9KmFa7y3f3eqxtrypbfIWKZ6TH6zv_Z7_XSV7VLxq6CJdlviAFaT7qomPh_gYr-8iLXcjYBJU5ikhd0mwUWNnh2eYpAg$>.
You are receiving this because you commented.Message ID: ***@***.***>
|
In the temp repo?
Relatedly, what is the Git version you have? |
I haven't forgotten about this! Just a tad busy at the moment 😅 |
I looked into this today and I simply don't have the time to investigate a fix with the proper care. If indeed a modified command of the form |
Situation I'm trying to do:
Alice creates a collection and wants to share it (ki clone, then publish to GitHub)
Bob wants to pull in Alice's collection.
From what I've gathered so far...
Bob could need to :
ki clone
on existing collection./anki_decks
)git sugmodule add https://github.com/mshafer1/anki__ccna.git
(or wherever Alice published)How does Bob then use ki to push this into Anki?
The text was updated successfully, but these errors were encountered: