Material Files (for easy access to copy file path)
To upload a folder and its files to a GitHub repository using Termux, you can follow these steps:
-
Install Git and GitHub CLI by running the following command in Termux:
pkg install git gh -
Log in to your GitHub account using the
gh auth logincommand:gh auth loginFollow the prompts to enter your GitHub username and password. If you have two-factor authentication (2FA) enabled on your account, you will be prompted to enter a verification code.
-
Navigate to the folder you want to upload to your GitHub repository using the
cdcommand:cd path/to/folder -
Initialize a Git repository in the folder using the
git initcommand:git init -
Add the files in the folder to the Git repository using the
git add .command:git add . -
Commit the changes using the
git commitcommand:git commit -m "Initial commit"Replace "Initial commit" with a descriptive message for the changes you've made.
-
Create a new GitHub repository or navigate to an existing repository where you want to upload your files.
-
Copy the SSH or HTTPS URL of your GitHub repository.
-
Add your GitHub repository as the remote repository for your local Git repository using the
git remote add origincommand:git remote add origin <SSH or HTTPS URL>Replace
<SSH or HTTPS URL>with the URL of your GitHub repository. -
Push the files to the remote repository using the
git pushcommand:git push -u origin mainReplace
mainwith the name of your branch.
💡 If you get this error error: src refspec main does not match any when using the git push command then run:
git checkout -b main
Replace main with the name of your branch.
After running these commands, your folder and its files will be uploaded to your GitHub repository. You can check your repository on the GitHub website to confirm that the files have been uploaded successfully.
- If you found this tutorial helpful, please consider subscribing to my YouTube channel to support my work! I create tech-related content that you might find useful, and I would really appreciate your support. Thank you for using my tutorial, and I hope it was helpful to you!