Godot and GIT on Android
I have a large tablet, combined with a Bluetooth keyboard it’s pretty much a laptop. Good enough to write a few small Godot games.
Esentially all I want is to be able to make changes to my Godot project and push them to GitHub. Here’s how I managed to achieve this:
Steps
1: Install Godot on Android (duh).
By default Godot will store projects in the Documents folder on your tablets Main Storage. That’s good enough.
2: Install “Termux”.
Basically a Unix terminal on Android. Wonderfull stuff. You can simply find it on the AppStore.
3: Launch Termux and type:
pkg install git
As you might imagine, we now have GIT installed
4: You will need to enable storage device access for the Termux app:
termux-setup-storage
This will launch androids’ storage access settings page. Find Termux on the apps list and enable storage access.
5: On GitHub you will need to generate a Personal Access Token.
It’s essentially the password you will use to access your projects, since GitHub no longer supports user passwords. At the time of writing it’s hidden in Settings->Developer Settings (very bottom of list)->Personal Access Tokens. Highly recommend googling more about this step, as there are lots of options and security concerns involved. Tread carefully.
6: Almost there, but I needed a couple more things:
You will most likely get an error. I needed to set up a couple of global variables for GIT before proceeding
git config --global user.name {YourUserName}
git config --global user.email {YourEmail}
git remote add origin https://github.com/Username/ProjectName
git push --set upstream origin main
Note: I don’t exactly remember the last two, in my case I created the repo on GitHub, comitted and pushed an empty file to test. Only THEN cloned the repo into an existing Godot project. Needless to say it was a mess so maybe some of those steps are not necessary.
7: Finally you are ready for the clone:
Make sure you are in the documents folder.
cd storage/documents
git clone https://github.com/Username/ProjectName
8: Great! Now, after you make some changes you can commit and push them:
git commit -m "My First Commit"
git push -u origin
Common Problems
The following untracked file would be overwritten…
git clean -d -f
Very dangerous! Deletes untracked files. But works perfectly for my use case (.gitignore not where it should be)
Random notes
If you mess up which branch is default (GitHub names them “main” rather than “master” you can rename and set default branches on GitHub web)
If you need to delete a directory and its contents remember to use GIT!!!:
git rm -r