So in this post, we will see how we can create a remote repository using Github. Github is a version controlling system that hosts the code. There are multiple options to host your code on the internet like Gitlab, Beanstalk, Bitbucket, etc. In this tutorial, we will work with Github. So for that, we have to create our account on GitHub. After creating the account on Github its home page will look like this.

As shown in image click on new repository to create a repository. You will get to see the page like below.

Enter repository name, description. Keep it public for now. You can add the README.md file if you want by clicking on the checkbox. Then click on create repository button.
After clicking on create repository you will get to see this page, which means we have created our remote repository. This page consists of instructions to upload your code to your repository. We will follow the second instruction since we already have our code.

We will get back to our git bash terminal and execute “git status” if changes are there we will commit them, then I’ll execute the following command to see whether there is any remote repository added for this local repository.
git remote

After executing git remote it gives me nothing that means there is are remote repositories added. We can do that in following way.

Copy the first line of 2nd instruction and paste it in terminal and then hit enter.
git remote add origin repository_url
Now if I execute git remote command then it will give me remote as origin. To see the link of remote execute following command:
git remote -v

Now copy and paste the next command i.e.
git branch -M main

After that push your code using this command:
git push -u origin main

As soon as you hit enter you will get a pop-up to enter your github username. Enter your username and click on ok.

After you have entered your username you will get a pop-up to enter a password. Enter your password and click on ok. If the username and password are correct then it will push your code on the GitHub repository.


As we can see my files are added to the GitHub repository. We will get to see the commits we have made. Also, the files and folder names are in the .gitignore file will not be pushed to the remote GitHub repository.
So now if I made any changes in my local code I can push it in following way:

Here I made some changes into renamed_second.txt and now I’ll commit those changes.

After committing the changes use following command to push your code on github repository:
git push
It will ask to enter your username and password to push the changes. Enter correct credentials and click on ok. Your changes will be pushed on the GitHub.

This is how you can push your changes on the GitHub. You can also pull the changes using following command:
git pull
You can use this command if there are changes made by any other contributors.