Skip to content

Github Sync

davidbannon edited this page Oct 4, 2021 · 14 revisions

Github Sync

Draft - applies to beta release of tomboy-ng v0.33d. Available from the github release page. If you use this, please report your experiences, good or bad.

Overview

You can use Github Sync in the same way as File Sync or Tomboy's Network Sync, sync to it with one to many instances of tomboy-ng on Linux, Windows or MacOS. Keeps all your notes available and, incidentally provides a useful backup.

In addition, syncing to Github allows you to access your notes through Github's pretty reasonable Markdown editor. So, view and edit using your phone, tablet or a friend's computer. Need nothing but a browser.

Security and Privacy

Everyone has a different view of these issues. When you move your notes into a cloud service, any cloudservice, you need to consider your need for security and privacy. Github allows you to set a repository as private, denying assess to anyone you have not authorised. But how securely ? And does Github staff have access, maybe they are required by civil authorities to disclose your content ?

Github Sync in tomboy-ng allows "selective sync" - only notes in a particular Notebook, SyncGithub are moved to Github. Clearly, this is no longer a general purpose sync service if you take that approach, its your choice. You can use both File Sync and Github Sync on the same notes repository, in this model, Github is just there to allow mobile access to those notes you select.

You also need to consider if using Github Sync exposes other content you may have on Github.

In use, tomboy-ng is given an Access Token you generate in Github. This token will allow access (read AND write) to all your Github repository. It is stored in tomboy-ng's config with only minimal attempt to obfuscate. If someone has unfettered access to your computer and medium IT skills, they can get to that token. If this is not acceptable to you, do not use this service (and perhaps tell me, maybe I add a password at tomboy-ng startup ?).

Requirements

Pretty simple, tomboy-ng 0.34 (or 0.33d for the risk takers) and a github account, network access. Github accounts are free. Github puts a limit of 5000 "accesses" per day, that could be a problem for people with very large note collections but, IMHO, the mobile access model might be a bit awkward with all of a large collection uploaded anyway. Paid Github accounts do not have that 5000 per day limit.

SetUp

  • Firstly, decide now if you will use a "selective sync" or sync your full repository. You can change later (easy to remove and recreate the repo) but better to get it right the first time. If its selective, create a tomboy-ng notebook called SyncGithub (yes, cases sensitive, no space) and maybe add some notes to it.

  • Next, if you don't already have a Github account (or want a separate one for this purpose) go to https://github.com and create that account.

  • Finally, back in tomboy-ng (0.33d or later), click the menu, Settings, Sync tab. Set the Sync Type to Github (this will not affect your File Sync if you have one). Now, you need two things, the github username, and a Github Token (see below), enter them and click Setup. If you have a lot of notes, its likely be a bit slow from here on.

Access Token

Have you read the last paragraph of the Security and Privacy section ? Please read it again.

Github's preferred access model involves a security Token, its a 40 character "word" you generate on their website when logged in. For tomboy-ng's purposes, the default token is fine, don't give it any more permissions. This token could potentially allow someone with access to your computer to mess with your Github repositories.

Go to https://github.com/settings/tokens/new enter some arbitrary note in the field, don't enable any of the boxes, choose what you think is a reasonable expire time and hit the green "generate Token" button. Copy the text of the token into your clipboard and paste it into tomboy-ng's Token field.

If you are replacing an expired token, paste it over the existing one (ensuring none of the existing one is left) and click the Sync Enabled tick box, off and then again to turn it back on.

FAQ

Remove, replace, reset my Github Repo.

You may want to do this to stop using Github, you want to change your decision about Selective Sync or you need to remove note content retained in Github's history. Its quite easy and safe if done correctly, while other approaches may seem easier, please don't experiment with content that matters!

  • First, if you intend to make a new Repo, go to all your tomboy-ng clients and sync them, having them all on the same sync level makes reestablishing sync a lot easier.

  • Logon to Github's web page, browse to the tb_notes repository and click the "gear icon, Settings" near to top row. That takes you to settings for this repo, scroll down to the very bottom, last entry under Danger Zone is delete this repository, click the button, type (or copy and paste) the exact repository name, it MUST be your_user_name/tb_notes. Done, Github indicate that content is now permanently gone.

  • If you want to now recreate the repo and, perhaps change your Selective policy, now is the time to play with SyncGithub notebooks.

  • Back in tomboy_ng, Settings, Sync Tab, Github, your user name and token (if current) should still be displayed, click Setup. You will be asked if you wish to create a new repo, you do. It does a test run, you click Save and Sync, it might be a bit slow.

  • When thats finished (and not before), go to each one of your other tomboy-ng instances in turn, same thing, click SetUp, no questions about creating a repo this time, but depending on your previous sync state, you may get some clashes. If you did run a full sync before this all started as recommended, you can safely tell tomboy-ng to use all the remote notes and let it run.

I want to stop using Github

OK, easy. In tomboy-ng, Settings, Sync Tab, Github. Click the Sync Enabled checkbox so it is not longer checked. You probably want to remove the Github repo, see above.

I want to use Selective Sync

If you are already using Github Sync but not Selective, your best approach (by far) is to remove the Github sync repo (see above), make a new notebook called SyncGithub (exactly like that) and add least one note to and then create a new repo. Then, bring your other instances of tomboy-ng back into the new sync with the Setup button. You need only add that Notebook in the tomboy-ng instance that you use to make the new repo, when you rejoin the others, they will download the new notebook.

Warning, trying to convert an existing Github repo to a Selective one does not work as you might expect, that's for a number of reasons, chief one being the Github keeps a copy of every old note it has every seen. Remove and re-create is safe and easy.

I don't want to use Selective Sync

OK, the answer (and background reasons) is almost the same as changing to Selective Sync (above) except that after you remove the existing Github repo and before you re-create it, you MUST remove the SyncGithub notebook from EVERY instance of tomboy-ng you use. You do not need to take notes out of the notebook before you remove the notebook, the notes will be safe.

Can I recover a previous version of a github note ?

Easily ? No !

Willing to play a bit, maybe. Github keeps every revision of your notes it has seen. In their web interface, you can go back to a previous version of a note, download to your computer (no, not in tomboy-ng) as a markdown file. I make another app called TomboyTools, https://github.com/davidbannon/TomboyTools that will allow you to import that markdown note into your tomboy-ng repository converting it to Tomboy XML. I have not tested this ...

Clone this wiki locally