{"id":13581338,"url":"https://github.com/after-eight/regitable","last_synced_at":"2025-04-06T07:31:58.913Z","repository":{"id":45031024,"uuid":"322599690","full_name":"after-eight/regitable","owner":"after-eight","description":"reGitable - backup your reMarkable using git.","archived":false,"fork":false,"pushed_at":"2020-12-23T01:16:57.000Z","size":4549,"stargazers_count":92,"open_issues_count":5,"forks_count":5,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-05T20:47:06.403Z","etag":null,"topics":["entware","git","git-lfs","remarkable-tablet"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/after-eight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-18T13:14:55.000Z","updated_at":"2024-10-25T20:44:37.000Z","dependencies_parsed_at":"2022-07-31T16:39:09.974Z","dependency_job_id":null,"html_url":"https://github.com/after-eight/regitable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/after-eight%2Fregitable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/after-eight%2Fregitable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/after-eight%2Fregitable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/after-eight%2Fregitable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/after-eight","download_url":"https://codeload.github.com/after-eight/regitable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247450173,"owners_count":20940869,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["entware","git","git-lfs","remarkable-tablet"],"created_at":"2024-08-01T15:02:00.501Z","updated_at":"2025-04-06T07:31:58.348Z","avatar_url":"https://github.com/after-eight.png","language":"Shell","funding_links":[],"categories":["Shell","Cloud Tools"],"sub_categories":["Launchers"],"readme":"# reGitable - backup your reMarkable using git\n\n# [\u003cimg src=\"perfectgit2.png\"\u003e\u003c/p\u003e](https://github.com/after-eight/regitable)\n\n## Objective\n\nMost of my digital life is stored in a git repository, so the first thing i thought of when i examined my newly arrived reMarkable2 was: can i install and use git on it?\n\nThe filesystem layout of the reMarkable meets the requirements for a git repository pretty well.\nBesides the binary `.rm` and `.jpg` files, all other files are more or less json-formatted text files.\nPlus, the filenames are immutable uuids, so even if you rename a notebook or move it from one folder to another, all that changes is the `parent` entry in the `.metadata` file.\n\nEven though the `.jpg` files are tiny, because they get compressed really hard and with low quality, and the `.rm` files don't grow _that_ large because they're one file per page, yet i decided to go the git-lfs route. The setup is a bit more complex, but most of the work is done by the install script anyways, and the result is absolutely worth it.\n\nBy pushing changes to a remote repository instantly, i do not only have a backup of all my notebooks in the cloud.\nThe repository contains all the back-versions of my files, and should i need to return to a long ago previous version of a file, or have to recover a deleted file, i can simply check it out of my repository and re-upload it onto my reMarkable.\n\nIf you're a little paranoid like me, simply install a privately hosted GitLab instance, and all your files are completely under your control.\n\nThough git of course knows push as well as pull operations in all repositories, i use this solution as a \"one way street\" (aka backup).\nI only do pushes from the reMarkable, never pull.\nAll other clients should only be used to pull, never push.\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Prerequisites\n\n### Entware\n\nBefore you can install and use reGitable, you have to install [reMarkable Entware](https://github.com/evidlo/remarkable_entware).\n\nThe installation is very easy and straight forward, thanks to Evan Widloski at this point.\n\n### Git-LFS\n\nUnfortunately, the git-lfs package is not (yet) available via Entware.\n\nThe reGitable installer comes bundled with the arm version of the git-lfs binary and will install it directly.\n\n\n### Remote Repository\n\nBoth GitHub and GitLab offer private repos for free, which is the easiest way to get started. Simply create a new repository (leave it \"blank\", do not create a `README.md` file), upload the public ssh key that is created for you during the installation of reGitable, and you are ready to go.\n\nTo increase privacy, you can use an on-premise GitLab installation.\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Installation\n\nClone this repository and copy the `.regitable` folder to your device:\n*Caution: the last command will overwrite the files on the device, should they already exist*\n\n```\ngit clone https://github.com/after-eight/regitable.git\ncd regitable\nscp -r .regitable/ root@10.11.99.1:\n```\n\nssh into your device\n\n```\nssh root@10.11.99.1\n\ncd ~/.regitable\n```\n\n\n### Edit config\n\nOpen the `config` file with `nano` or in the editor of your choice and adjust the variables in the `personal` section to your liking.\n\nIf you just want to track your files locally without pushing to a remote repository (yet), simply set the `GIT_REMOTE` to an empty string.\nYou can add it anytime later.\n\n```\n# ----------------------------------------------\n# personal\n# ----------------------------------------------\nGIT_USER=\"my-name\"\nGIT_EMAIL=\"my-email@my-domain.com\"\nGIT_REMOTE=\"git@gitlab.com:my-gitlab-name/my-gitlab-repo.git\"\n```\n\n\n### Run install script\n\nStart the installation like so\n\n```\nsource ./config\n\n./install.sh\n```\n\nTo authenticate your reMarkable against a remote git repository, you have to copy-paste the public ssh key displayed at the end of the installation to your user profile on the server.\n\n```\nssh-rsa AAAAB3NzaC1yc2EAA...\n                           ..........\n                                     ... root@reMarkable\n```\n\nGo to your GitHub/GitLab user profile, to the \"ssh keys\" section, add a new key and paste inside the public key.\n\n\n### First commit\n\nTo add the status quo of your files to the repository, run:\n\n```\ngit add -A .\ngit commit -m \"initial commit\"\n```\n\nIf you have a remote configured and already uploaded your public ssh key:\n\n```\ngit push --set-upstream origin master\n```\n\nIf this is the first time you connect to your remote from the reMarkable (which is likely), you have to confirm the fingerprint shown by the ssh client to save the host signature to your `known_hosts` file.\n\n\n### Enable/disable the service\n\n```\nsystemctl daemon-reload\nsystemctl enable --now regitable\n```\n\nThis will start the service immediately, and on every reboot.\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Cloning\n\nBecause the `.gitattributes` file is not part of the repository and not checked in (see the reason why in the `Issues` section below), you have to take special care when cloning the repository to your host machine.\n\n\n### git-lfs, part I\n\nOf course you need to have git-lfs installed. Follow the instructions for your platform here https://git-lfs.github.com/ to do so. At the end, run\n\n```\ngit lfs install --local\n```\n\n### ssh key\n\nMake sure you have a public/private key pair to access the server from your host.\nYou might use the same as the one stored on the reMarkable, but it's better practice to use a dedicated one:\n\n```\nssh-keygen -b 4096\n```\n\nCopy the public key to the server, and store the private key locally under a name you like eg. ~/.ssh/me@remarkable2.\n\nIf you have multiple projects on a server like github.com or gitlab.com and use different keys on each of them, the best way to distinguish between them is to create a separate entry in the config file like so:\n\n```\nHost remarkable2.gitlab.com\n  HostName gitlab.com\n\tPort 22\n\tUser git\n\tIdentityFile ~/.ssh/me@remarkable2\n\tIdentitiesOnly yes\n```\n\n### clone, but *DO NOT* checkout yet\n\nClone your repository, but do not checkout the files yet.\nTo achieve this, use the `--no-checkout` switch.\n\nReplace the server-part of the ssh-url, that you got from GitHub/GitLab, with the one you created in the config file, eg\n\n```\nreplace\n\n  git clone --no-checkout git@gitlab.com:...\n\nwith\n\n  git clone --no-checkout git@remarkable2.gitlab.com:...\n```\n\nThis way, git knows which ssh key to use.\n\n\n### git-lfs, part II\n\nCreate a `.git/info/attributes` file inside the cloned repository and paste the following lines:\n\n```\n*.rm filter=lfs diff=lfs merge=lfs -text\n*.jpg filter=lfs diff=lfs merge=lfs -text\n*.pdf filter=lfs diff=lfs merge=lfs -text\n*.epub filter=lfs diff=lfs merge=lfs -text\n```\n\n\n### checkout / pull\n\nNow your repository is ready to be checked out:\n\n```\ngit checkout master\n```\n\nand for future updates simply do\n\n```\ngit pull\n```\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n## Internals\n\n\n### timezone\n\nThe factory setting for the time-zone in my reMarkable was `UTC`.\nThis led to all my timestamps for my commit messages being UTC as well.\n\nTo change the timezone, simply follow the instructions from here: https://remarkablewiki.com/tips/timezone.\n\nIn my case, i used the \"manual\" method:\n\n```\ntimedatectl set-timezone CET\n```\n\n\n### how it works, inotify, tickets, debounce\n\n(TODO)\n\n\n### git --git-dir and --work-tree\n\nThe notebook files on the reMarkable are stored in `/home/root/.local/share/remarkable/xochitl`, which would also be the place where git would normally place its `.git` folder.\nBut i was unsure if `xochitl`, or some other service running on the reMarkable, would get upset finding a `.git` directory inside this folder.\nSo i decided to make use of the very handy `--git-dir` and `--work-tree` options to separate the two.\nThis way, the data directory stays untouched, and we can place the `.git` directory any place we like.\n\n```\ngit --git-dir=\"/home/root/.regitable/.git\"  --work-tree=\"/home/root/.local/share/remarkable/xochitl\" init\n```\n\n\n### git and ssh (sshcommand)\n\nI had a hard time getting the dropbear ssh client, which is installed on the reMarkable, to work with my remote repository via ssh.\nWith openssh, an entry in the `~/.ssh/config` is sufficient to point the client in the right direction.\nTo persuade the dropbear client to use my ssh key from within a `git push`, i needed to set the `core.sshCommand` in the git config:\n\n```\ngit config core.sshCommand \"ssh -i $GBUP/remote.key\"\n```\n\n\n### git lfs\n\nUnfortunately, `git-lfs` is not (yet) available via Entware.\nFor your convenience, i bundled the arm version from their GitHub releases Page into this repository.\n\nFeel free to check for a more recent version from here: https://github.com/git-lfs/git-lfs/releases.\n\nFor the same reason as the `.git` folder, i did not want the `.gitattributes` file to be in the data directory.\nThough this means a little more work when cloning (once), to me it feels more solid.\n\n\n### flock\n\n(TODO)\n\n\n### inotifywait\n\n(TODO)\n\n\n### dropbearkey\n\n(TODO)\n\n\n### systemd\n\n(TODO)\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Tools\n\n### GitHub / GitLab\n\n- hosted / on premise (GitLab)\n- CI/CD, pipelines, pages\n\n(TODO)\n\n\n### VSCode\n\n- how to use with GitLens\n\n(TODO)\n\n\n### Labcoat (GitLab on Android)\n\n(TODO)\n\n\n### ConnectBot (ssh client on Android)\n\n(TODO)\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Issues / Caveats / Limitations\n\n\n### Memory\n\nThe nature of git is to store a copy of every file that was ever committed forever, even if you delete it from the work directory.\nIt does this in a compressed and efficient way, but still: over time, a git repository will grow and grow and grow.\nPlus the additionally needed packages from `entware`, `inotifywait` and of course `git` and `git-lfs` themselves.\n\nEven though i experimented with the device quite excessively: created tons of notebooks, scribbled around, added and deleted pages, renamed, moved and trashed them, my repo size is still far below `40 MB`.\nThe reMarkable is equipped with `8 GB` of storage, but only time can tell if there will be any memory shortages.\n\nWith the help of `git-lfs` and a `git lfs prune` after every push, the storage needed for the copies of the binaries is a small as possible.\n\nBut still: the memory of your reMarkable gets halved.\n\n\n### Integration\n\nThe folks at reMarkable seem to be quite open-source friendly, but unfortunately their main application `xochitl` is closed source.\nThis makes it hard to intercept file changes, and to find the right time to issue a `git add/git commit`.\nI use `inotifywait` to watch the data directory for changes, and the package does an amazing job.\nBut i wished there were at least some \"hooks\" to interact with `xochitl` directly, as this would make the timing issue much more stable.\n\n\n### reMarkable Updates\n\nAfter an OS update on your reMarkable, entware and reGitable will no longer be active, because reMarkable resets everything outside your home directory.\n\nTo re-enable both, first run the `entware_reenable.sh` script, and the run `regitable_install.sh` again. Don't worry, it will not overwrite your existing files, but re-install the reGitable service in systemd.\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Credits and Links\n\n- [reMarkable.com](https://remarkable.com/)\n- [Awesome reMarkable](https://github.com/reHackable/awesome-reMarkable)\n- [Git-LFS](https://git-lfs.github.com/)\n- [reMarkable Entware](https://github.com/evidlo/remarkable_entware)\n- [reMarkable Wiki](https://remarkablewiki.com/start)\n- [r/RemarkableTablet on Reddit](https://www.reddit.com/r/RemarkableTablet/)\n- [ssh on reMarkable](https://remarkablewiki.com/tech/ssh)\n\n\n\u003c!-- ------------------------------------------------------------------- --\u003e\n\n\n## Disclaimer\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafter-eight%2Fregitable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafter-eight%2Fregitable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafter-eight%2Fregitable/lists"}