Can I commit files to GitHub from Android Phone

Viewed 16912

I've been doing a school assignment on HTML and CSS. It was an easy assignment and I almost missed the due date when I was away for the weekend.

I have done the assignment on my phone but to hand it in I have to put it on my GitHub page.

Is there a way to put files from Android onto my GitHub page?

4 Answers

If you are happy to use the command line on your phone, and you are running Android 5 or above, then try installing the Termux app. You can then pkg install git, clone your GitHub repository (if you don't yet have a repository, create one on GitHub's website and it will tell you the commands you need), move the files into it (if you've already edited files outside of Termux, then you might need to type termux-setup-storage and check inside the storage directory to find them), and do the git add * and git commit -am files and git push.

Alternatively if it is just one or two small files then you might find GitHub's "online code editor" useful.

A third option is if you are able to transfer the files to a server somewhere (for example, use SpeedSoftware Explorer to create a zip, and use a CGI script or something to help you upload that zip to your server, or improvise an scp command or equivalent, or even use DropBox if you also have it installed in your home directory on the server), then SSH into the server and run the git commands from there.

I've managed to get file editing + committing work via the GitHub Android app, but it's hack-ish. Hopefully it doesn't stop working in future.

Steps:

  • Install GitHub Android.
  • From within the app, go to your desired repo's root.
  • Share the link with a text editor or message app.
  • Touch that link. It'll open the GitHub desktop page inside the Android GitHub app.
  • Touch the options (3 dots) in the right hand corner, select "Add to Home screen"
  • Minimize everything.
  • Touch your new shortcut (will open in app), and browse to the desired repo.

Voila - full editing and control on phone.

The nice thing about this approach is that the home screen shortcut opens the app as a kind of separate mode, meaning you can still use the normal app functions by opening the "real" app icon in your app drawer. This launches two instances of the app: the traditional read-only version, and the edit-happy version - and you can switch between the two via your recents.

Related