Hey fellow readers!
If you are a newbie to GitHub and the open-source world, then you should learn git commands as well. Believe me, that is really easy if you do with me.
In this post, i will teach you how to deploy your projects on github pages(gh-pages) using git. So a lot know and a lot to discuss as always
So for this you need:
- a github account
- git windows application (since i am a window user, i will be using git window commands).
So lets start the deployment with git. For this, launch git application on windows.
Set your username with this command
git config --global user.name "Vikas Singh"
Set your email id with this command
git config --global user.email "firstname.lastname@example.org"
Switch to the directory where you want to do the entire deployment work. I will suggest creating a new directory for that purpose.
Like here I have created the folder named "vikasgit" in my "Documents" folder. So I used the "cd" command 2 times. And to create new folder i used the command below:
Now initialize an empty git repository in that folder "vikasgit"
Clone the repo on which you want to deploy your projects.
git clone [repo link]
Now again switch to the repo.
Add your project files manually in the repo which is now created in your system locally.
Now switch to the GitHub-pagesbranch. This command is used to switch to any branch.
git checkout gh-pages
NOTE: To create a new branch use this command
git branch -b [branch-name]
Stage the changes made recently.
git add .
Commit the changes
git commit -m "first commit"
Check the status of the current repo.
Finally push the new changes.
push origin gh-pages
NOTE: Check the log (history of the current repo)
Follow me on Instagram
Follow on Twitter
You can read my previous post here!