This is the AMP version of this page.
If you want to load the real page instead, click this text.

Tutorial How to upload files on Github repo properly using an Android phone

Deleted User 832058

Awesome Active Platinian
I have seen most peoples uploading a .zip file instead uploading files normally. I understand the case that only device they have is an Android phone, and uploading multiple files isn't really possible, but this way is really bad practice. We want to view source directly without having to download zip first. When that’s the case, what do you do? Thanks to a handy tool called MGit, it is possible to install the Git client on a mobile device.

Using Git is not just a simple file uploading, it is a version control system and it requires a necessary steps to upload files. It may be confused for the beginners who are new to Git. I’m going to walk you through the process of getting this up and running. I’ll demonstrate on an Android emulator because my old phone sucks, but I don't feel the need to use my smartphone for other things than calling, browsing and important task

I will only cover how to upload files on your repo. To learn more about Git, please refer to "Git for Beginners" or Git documentation. Google is your friend :))
I'm also don't have much experience with Git, so I may have explained it incorrectly

What you need
The only things you need are a device running version 5.0 or newer of the Android platform and a GitHub account. That’s it.

Let’s make this happen.

Creating Personal access tokens
We will need a personal access token to use in place of a password with the Git client

Go to your token settings in Github settings
Click Generate new token



Give your token a descriptive name. To give your token an expiration, select the Expiration drop-down menu, then click a default or use the calendar picker.

Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo.



Click the green button Generate token

Your token will be created.

Make sure to copy your token now. You won't be able to see it again!

Warning: Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.



Creating new Github Repo
You can do that by click on "+" sign > New repository or go to github.com/new

Before you create, make sure to add a README file or you can add other files later of your choice, in order to avoid strange error when MGit when working with empty repo



Setting up MGit
The first thing to do is install MGit. This is done from the Google Play Store

And you need to install file manager app if your choice. we will use X-plore

Once installed, open the app.

Click on plus "+" sign, and give your repo in the Remote URL. Click CLONE



Your repo will be cloned. It is stored on /storage/emulated/0/Android/data/com.manichord.mgit/files/repo



You can now add files you want to be pushed to your repo. I used X-plore and copied my project to my Git-Test repo



Go back to MGit, and open up your repo. The files will be shown



This is where it gets slightly tricky. This isn't a simple uploading like I said before. Click on the 'hamburger' menu on the right-top corner, and click Add all to stage. We want to upload all files



We want to add user and email for commit infomation, this is necessary. Scroll down and click Raw config

Give your user and email. You can give fake info if you want, it doesn't harm



We need to commit the change. Open the menu and Click Commit



Give your appropriate message and commit



Now the final step, pushing, which means uploading. Open the menu and Click Push



Check Push all? and Force push? and click on origin



Upon pushing, it will ask for Authentication. Give your Github username and your TOKEN key we created previously, not your Github password. Save user and pass if you want. Click DONE



Once you authenticated, and when successful, a message dialog will look like this



And there you go. A handy way to work with Git on your Android device. Now… git to work.

Editing, adding or removing files
When you do, you need to follow the following steps again

1. Add all to stage (you only need when you add or remove files. Otherwise, do if you have issues pushing some files)
2. Commit
3. Push