GitHub is a popular platform that allows you to store and manage your code repositories, collaborate with others, and contribute to open-source projects. Whether you are a beginner or an experienced developer, GitHub can be an invaluable tool. In this blog post, we will guide you through the process of setting up a GitHub account, creating a repository, using Visual Studio Code (VS Code) with GitHub, and setting up GitHub with Termux.
Setting up a GitHub account
To get started with GitHub, you'll need to create an account. Head to github.com and click on the "Sign up" button in the top right-hand corner of the page. You'll be asked to enter your name, email address, and a password. Once you've filled out the form, click "Create account" to create your account.Creating a repository
Once you've created your account, the first thing you'll want to do is create a repository. A repository is where your code will live, and it's what you'll use to collaborate with others. To create a repository, click on the "New" button on the left-hand side of the page. You'll be asked to enter a name for your repository, a description (optional), and whether you want the repository to be public or private. Once you've filled out the form, click "Create repository" to create your repository.Using VS Code with GitHub
Visual Studio Code (VS Code) is a popular code editor that can be used to manage your GitHub repositories. To use VS Code with GitHub, you can simply use the period key (.) on your keyboard to open the VS Code editor. Alternatively, you can change the URL from .com to .dev and press enter to open the VS Code editor. Once you are in the VS Code editor, you can edit code, commit changes, and push changes to GitHub.But if you like CLI more than GUI, then follow following step to setup GitHub via CLI.
Here I am using Termux, but you can follow same steps on any Linux distro and if you on windows or Mac you download GitHub from here for that.
Setting up GitHub with Termux
Launch Termux and run the following commands to update and upgrade the package listpkg update && pkg upgrade
Install Git by running the following command:
pkg install git
Configure your Git username and email by running the following commands
git config --global user.name "Your Name"
git config --global user.email "youremail@example.com"
Replace "Your Name" and "youremail@example.com" with your own information.
Now just create a directory where you can store store all the files you need
mkdir <dir name>
Or you can clone your repository which you are
git clone https://GitHub.com/username/reponame.git
Replace username and reponame with your own one's
Then just cd to the directory you created
cd <dir name>
Now just copy and paste the commands given by GitHub and execute it
Once you execute it it will ask you for your username and password, so just enter your username for password you need to get a access token from github
Generate an access token on GitHub by following these steps:
Log in to your GitHub account and go to "Settings".
Click on "Developer settings" in the left-hand sidebar.
Click on "Personal access tokens" and select classic then "Generate new token" and here also classic token.
Give the token a name and select the appropriate scopes for your needs.
Click "Generate token" and copy the token to your clipboard and paste it in place of password
Now if you go to your GitHub repo you will find a new readme.md file in it.
Next if you want to add a new file to GitHub, then first add it
git add .
Commit it with a message
git commit -m "Your Message"
And finally push it
git push
And that's how you can push any file to GitHub
So that's all, Hope you find it helpful