Skip to content

For Android users

Charles Chiu edited this page Oct 15, 2022 · 12 revisions

Initial steps to install git and link it with logseq

  1. Install Termux in Android, using the F-droid app. Follow instructions here.

  2. Open Termux and type pkg install git to install Git.

  3. Configure Git username and email:

    git config --global user.name "John Doe"
    git config --global user.email johndoe@example.com

    NOTE: This is the name and email which will go into commits, it can be anything, not necessary related to your GitHub account.

  4. In the Termux terminal, type termux-setup-storage to allow Termux access to your internal storage and/or SD card

  5. In the Termux terminal, create a folder for your graph, for example cd documents; mkdir MyGraph and clone your repo there with the command git clone git@github.com:{your-username}/{your-reponame}.git ~/documents/MyGraph

  6. Open Logseq and add a graph on that folder. Check that all looks ok.

Install shortcuts to synchronize the repository

  1. Install Termux:Widgets from F-droid.

  2. In Termux, type cd ~/.shortcuts and edit a file named, for example, pull-graph containing:

    #!/usr/bin/bash
    source bin/source-ssh-agent
    cd {your repo location}  # eg: cd ~/documents/MyGraph
    git pull

    ※ Noted: If you use password-free private keys for Git you don't need the ssh-agent line. You can include it to avoid typing the private key passphrase each time.

  3. In the same ~/.shortcuts folder create a second one named, for example, push-graph containing:

    #!/usr/bin/bash
    source bin/source-ssh-agent
    cd {your repo location}
    git add -A
    git commit -m "sync from android"
    git push
  4. Add a widget for Termux Widget app to the Android screen, which will show the scripts available in ~/.shortcuts (in our example, it will show pull-graph and push-graph). Taping on them, they will be executed by Termux.

Android-Termux-Workflow

  • Tap pull-graph to download the most recent version of your graph from GitHub.
  • Open Logseq and admire the latest version of your notes.
  • Edit/add notes, work on them.
  • Exit Logseq and tap push-graph to upload your changes to GitHub.

Clone this wiki locally