ARE YOU A NEW DEVELOPER FACING CHALLENGES WITH HOSTING YOUR CODE ON GITHUB?
Yes, we are in the same boat paddling towards greatness, as an aspiring programmer working towards earning a career in the IT world, one of those things you must be very familiar with is github and its full usage. Imagine applying for an intern role in a hub and you are asked to present your github account so that they can check your work and progress in the industry so far, how do you go about that?
There are four basic steps, namely;
- Git clone
- Git add
- Git commit and lastly
- Git push
If you follow these steps you will never miss your way. Let’s do it together in the simplest way so that afterwards you can do it yourself..very simple
Go to the www.github.com (I’m sure you already have an account)
Then name your repository any name of your choice, put description if you like, make it public, ensured public is clicked and lastly on this page, initialize the repository with “README” then press on the green create button
Then it will redirect you to this page
you can see sniper because that’s the name i gave to my repository..if you can see something like this, definitely you are making progress…..then click on that green button “clone or download”
As you can see, a message has dropped below the green button, endeavor to copy that….copy that cloned link on my page…it read : https://github.com/wizardcalidad/sniper.git
Your terminal automatically opens the desktop page and you have to navigate to the main folder the code has been saved. On my PC, i have to open documents then the folder “sniper” how ?
on my terminal, i will change directory, to enter Documents i will type…
then to enter the sniper folder after i’ve been confirmed inside the Documents, i will repeat the same step
Once i’ve entered, the next is to clone..the first basic step stated above, type
it means you’re cloning the folder you are inside which is the sniper. Then the cloned link copied from the github webpage, paste it in front of git clone like:
git clone https://github.com/wizardcalidad/sniper.git
It will be cloned like the picture below shows, then open the folder location on your PC then automatically you will see a cloned folder of your folder in it…like mine..my folder is sniper, you can see another sniper in it.
Then copy other baby folders in your folder and paste them inside the cloned folder. In my case, i cut the folders of “CSS , IMG and index.html” all and paste inside the cloned sniper folder.
On opening it, you will find not just the moved baby folders but the README.md file initiated right from the github page. Then you can now go back to your terminal and enter the cloned folder in your main folder.
How do we enter? by selecting the folder with the command
cd sniper (because my folder was named sniper, yours should be different). Dont be afraid of the ls i declared, it is only used to list the content of my folder to confirm if they are really there.
So what next? So far, we’ve only cloned, dont forget we are still going to add, commit and push before our webpage can be live online through github.
Sorry, I missed the image of the next step but bet it you will get it.
we are going to add everything in that cloned file to our repository , HOW?
git add –all
(note the double dashes before all dash dash all)
possibly nothing will run imediately after, only if there is an error somewhere. After you’ve added up, next is to commit the message which is the feature of the website you’re hosting, endeavour to write your featured message using an action verb, It kills all the virus, it override the former etc, and ensure your features is followed by a colon and also in quote, dont panick, you do that by typing
git commit -m “Features: It teaches you how to shoot well”
(it teaches how to shoot well can be anything in your case)
Once it reads like this and commit every other thing in the folders to your repository, the next for you is to push…..
we push by using the code
it will ask for your github username and password
Once you have something like this, you’re done pushing your code. Now what are you going to do next? You are almost there
Go back to github, reload and you will see changes in form of list of items you’ve pushed, the click on the settings..
scroll down…..until you reach the github pages, then change the source to master branch
After selecting Master Branch..Check for the header notification of
“GitHub Pages source saved”
Then finally you’re there, copy the link to your webpage
and yes click on your page and view it live……………
Make sure you repeat the steps thrice or more, so that you won’t ever forget and come back to check…
Kindly read and share with friends..We love you.