{"id":35277370,"url":"https://github.com/davidkopp/termux-scripts","last_synced_at":"2025-12-30T14:04:52.951Z","repository":{"id":170922054,"uuid":"520026726","full_name":"davidkopp/termux-scripts","owner":"davidkopp","description":"Termux scripts to simplify syncing of Git repositories with Android devices","archived":false,"fork":false,"pushed_at":"2025-06-01T20:16:50.000Z","size":51,"stargazers_count":49,"open_issues_count":1,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-02T05:51:13.997Z","etag":null,"topics":["git","obsidian","termux"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/davidkopp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-01T08:29:27.000Z","updated_at":"2025-06-01T20:05:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"1019c57b-8e55-46c6-9c59-193438cfacd1","html_url":"https://github.com/davidkopp/termux-scripts","commit_stats":null,"previous_names":["davidkopp/termux-scripts"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/davidkopp/termux-scripts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkopp%2Ftermux-scripts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkopp%2Ftermux-scripts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkopp%2Ftermux-scripts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkopp%2Ftermux-scripts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidkopp","download_url":"https://codeload.github.com/davidkopp/termux-scripts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidkopp%2Ftermux-scripts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28127988,"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","status":"online","status_checked_at":"2025-12-30T02:00:05.476Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["git","obsidian","termux"],"created_at":"2025-12-30T14:02:29.274Z","updated_at":"2025-12-30T14:04:52.933Z","avatar_url":"https://github.com/davidkopp.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Termux scripts for syncing Git repositories\n\nThis repo includes scripts to simplify the setup of syncing Git repositories on Android devices using [Termux](https://termux.dev/). Termux is an Android terminal emulator and Linux environment app.\n\nThe original purpose for me was to auto-sync my [Obsidian](https://obsidian.md/) vault between devices with Git.\n\nThe idea to use Termux for automatic syncing came from [Rene Schallner](https://github.com/renerocksai): [Syncing your Obsidian vault to Android via an encrypted GitHub repository](https://renerocks.ai/blog/obsidian-encrypted-github-android/#shortcuts-for-committing-pushing-and-pulling)\n\nFor syncing I'm now using the script `git-sync.sh` by Simon Thum: [simonthum/git-sync](https://github.com/simonthum/git-sync)\n\n## Why use Termux?\n\nThere are many ways to sync git repositories with Android devices. However, in my experience, this setup with git inside the Termux environment is the most flexible and reliable.\n\nAlternatives:\n\n- Obsidian community plugin [Obsidian Git](https://github.com/denolehov/obsidian-git): Great on desktop, but the mobile version has some [limitations](https://github.com/denolehov/obsidian-git#mobile) that make it a bad choice for me.\n- Android app [MGit](https://github.com/maks/MGit/): No auto-sync in the background possible, has problems with storage permissions (see [issue 620](https://github.com/maks/MGit/issues/620)).\n- Android app [GitJournal](https://github.com/GitJournal/GitJournal): No auto-sync in the background possible.\n- [Syncthing](https://syncthing.net/): Generally a great solution for syncing! However, in my opinion you shouldn't use Syncthing to sync a Git repository. Also, I don't like having a file synced multiple times in the background while I'm editing it.\n\n## Setup\n\n### Preparation\n\n- Install [Tasker](https://tasker.joaoapps.com/download.html), [Termux](https://f-droid.org/en/packages/com.termux/), [Termux Widget](https://f-droid.org/en/packages/com.termux.widget/) and [Termux Tasker](https://f-droid.org/packages/com.termux.tasker/)\n- Inside Termux, install some required packages:\n\n    ```sh\n    pkg update \u0026\u0026 pkg upgrade\n    pkg install git openssh rsync\n    ```\n\n- Install an editor of your choice. See [available text editors in Termux](https://wiki.termux.com/wiki/Text_Editors). We use nano here as the default:\n\n    ```sh\n    pkg install nano\n    ```\n\n    If you don't want to use nano, you have to change the default editor for Git in `configure-git.sh`. If you want to customize nano you can find [here a how-to for Termux](https://github.com/SignsAriyo/How-To-Customize-the-Nano-Editor-on-Termux).\n\n- Give Termux access to your storage ([Termux-setup-storage](https://wiki.termux.com/wiki/Termux-setup-storage)):\n\n    ```sh\n    termux-setup-storage\n    ```\n\n### Setup SSH\n\n#### Accessing Termux from your computer (optional)\n\n_If you set up remote access to Termux on your Android device, the following steps will be easier._\n\n[Termux Remote Access](https://wiki.termux.com/wiki/Remote_Access)\n\nStart OpenSSH server in Termux:\n\n```sh\nsshd\n```\n\nAccess your Termux session from another device (change the IP address to the address of your device, e.g. use `ifconfig`):\n\n```sh\nssh -p 8022 192.168.0.108\n```\n\n#### Accessing remote Git repository\n\nIf you want to use SSH for accessing your remote Git repositories, create a new key pair:\n\n```sh\nssh-keygen -t ed25519 -C \"your optional comment\"\neval \"$(ssh-agent -s)\" # start the ssh-agent in the background\nssh-add ~/.ssh/id_ed25519\ncat ~/.ssh/id_ed25519.pub\n```\n\nCopy the public key to your Git remote server (GitHub, ...).\n\n### Setup git\n\n```sh\ngit config --global user.email \"you@example.com\"\ngit config --global user.name \"Your Name\"\n```\n\nClone this repo inside Termux:\n\n```sh\ncd ~\ngit clone https://github.com/davidkopp/termux-scripts.git\ncd termux-scripts\n```\n\n### Setup sync\n\n_Note: During the setup some changes are made to your git configuration. If you want other options, modify the script 'configure-git.sh'._\n\nFirst ensure that all scripts are executable:\n\n```sh\nchmod +x *.sh\n```\n\nYou can choose between the three different ways of setting up your repository/repositories:\n\n- Interactive mode (`setup-interactive.sh`)\n  - provides the possibility to clone a Git repository\n  - can also be used if a local Git repository already exists\n  - can be used for both, single-repo setup and multi-repo setup\n- Single-repo setup (`setup-single-repo.sh`)\n  - Git repository has to already exist locally\n  - path to this single repo is stored in a config file called `repo.conf` in your home directory\n- Multi-repo setup (`setup-multi-repo.sh`)\n  - Git repository has to already exist locally\n  - no central config file, path to the respective repository must be provided as an argument for each script later on (e.g. `sync.sh ~/storage/shared/git/notes`)\n\n#### Single-repo setup\n\nSingle-repo setup means that you only have one Git repository that you want to sync. The path to this single repo is stored in a config file called `repo.conf` in your home directory.\n\nYou can either use an interactive mode (`setup-interactive.sh`) or directly provide the required parameters as arguments to the script `setup-single-repo.sh`.\n\n```sh\n./setup-single-repo.sh path-to-repo branch-name\n```\n\nArguments:\n\n- `path-to-repo`: local path to git repo (required)\n- `branch-name`: git branch name (optional, default \"main\")\n\nExample with real values:\n\n```sh\n./setup-single-repo.sh ~/storage/shared/git/notes main\n```\n\nNow you are done with the setup in Termux.\n\nYou can now open your launcher's widget menu, select Termux:Widget and place the widget for a script on your home screen. If you want to setup automatic sync for a repository see the section [Setup automatic sync](#setup-automatic-sync) below.\n\n#### Multi-repo setup\n\nMulti-repo setup means that you have multiple Git repositories that you want to sync.\nThe path to a single repository must be provided as an argument for each script later on (e.g. `sync.sh ~/storage/shared/git/notes`).\n\nYou can either use an interactive mode (`setup-interactive.sh`) or directly provide the required parameters as arguments to the script `setup-multi-repo.sh`.\n\n```sh\n./setup-multi-repo.sh path-to-repo branch-name repo-name\n```\n\nArguments:\n\n- `path-to-repo`: local path to git repo (required)\n- `branch-name`: git branch name (optional, default \"main\")\n- `repo-name`: name used as a suffix for script names (optional, if not provided the name of the repo is used)\n\nExample with real values:\n\n```sh\n./setup-multi-repo.sh ~/storage/shared/git/notes main notes\n```\n\nNow you are done with the setup of one repository. If you want to setup another repository, just repeat the same steps and provide a different path to the script.\n\nYou can now open your launcher's widget menu, select Termux:Widget and place the widget for a script on your home screen. If you want to setup automatic sync for a repository see the section [Setup automatic sync](#setup-automatic-sync) below.\n\n### Setup automatic sync\n\nTo automatically commit and sync changes I use the Termux add-on [Termux:Tasker](https://github.com/termux/termux-tasker).\n\nTasker profile configuration (simplified):\n\n- Trigger:\n    - Every 1h\n    - Wifi Connected\n- Task \"Git Sync\":\n    - Flash with text (e.g. \"Git sync\")\n    - Termux:\n        - Executable: `sync.sh`\n        - Arguments (not used anymore, was used in the past to provide a path in a multi-repo setup)\n        - ✔ Wait for result for commands\n        - Timeout: 30 seconds\n\nMathis Gauthey has also published a great tutorial with some helpful screenshots: [How to Use Obsidian Git Sync on Android](https://mathisgauthey.github.io/how-to-use-obsidian-git-sync-on-android/)\n\nAs an alternative you can also setup a cronjob (see [here](https://forum.obsidian.md/t/guide-using-git-to-sync-your-obsidian-vault-on-android-devices/41887) for advice).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkopp%2Ftermux-scripts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidkopp%2Ftermux-scripts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidkopp%2Ftermux-scripts/lists"}