HOW TO SETUP GITHUB REPOSITORY.
What exactly is GitHub?
GitHub is a code hosting platform for version control and collaboration. It lets you and others work together on projects from anywhere. This blog will teach you GitHub essentials like repositories, branches, commits, among others.
- Create a new GitHub repo and name it with the same name as your local folder (in my case, 20percent)
Once you create a new repo, you will see a page similar to what’s shown below.
Do not be intimidated by all those commands. You don’t have to do all of that.
Now what we have to do is initialize our local git repository. (If you do not have git installed in your local machine, ensure that you have it installed)
To initialize your git repo, go to VSC, open terminal, and type
git init
To check the status of the files in our local git, type
git status
You will now see a list of files in your git repo. All of them will be marked in red and this indicates that these files are not up to date. We need to now push all these files from your local git repo to the 20percent git repo.
To indicate that we wish to add all these files listed to the 20percent repo, type
git add .
Now we have to transfer or commit all these files to the repo. Type
git commit -m "initial commit"
Note that the part after -m is the commit message. This message is for you to indicate what this commit is about.
We have to now link the local repo with the 20percent repo. To do so, type
git remote add origin <git repo link>
You may find your git repo link from your repo-created page as shown below.
So in my case, I will type
git remote add origin https://github.com/aryamurali/20percent.git
Now, we have to push all these files to the gh-pages branch of your 20percent repo. To do this, type
git push origin gh-pages
You may sometimes be asked to enter your login credentials to Github. Just enter your GitHub username and password if asked.
And you’re done.