1 - What is git what is github ?

GitHub is a code sharing plate-forme, on which you can publish projects whose code is managed with the Git version control system. By default, the system is open source, which means anyone can view the code, use it to learn or improve it, and collaborate on projects. You can therefore participate in other projects or, conversely, people can collaborate on your projects! In this article, we will see how to publish content to the web using "GitHub pages" (also called gh-pages) which is one of the features of GitHub.

2 - Download and Install Git

By default, Git is installed on Linux and macOS . However, Microsoft Windows does not include a Git command. Below are the steps to install and use Git and GitHub on Microsoft Windows.  

1 - Open the Git website. 
2 - Click the Download link
to download Git. The download should start automatically.
3 - Once downloaded,
launch the installation from the browser or from the download folder.
4 - In the Window Select Components,
leave all default options checked and check for other additional components you want to install.
5 - Next, in the Default Choice editor
used by Git, unless you're familiar with Vim, we strongly recommend using a text editor you're familiar with. If Notepad++ is installed, we suggest using it as an editor.
6 - Next, in the Adjust your PATH environment, we recommend that you keep Use Git by default in the Windows Command Prompt option selected, as shown below. This option will allow you to use Git from Git Bash or Windows Command Prompt.

 

 


7 - Then we recommend leaving
the default selected under Use OpenSSH.
8 - Then, in Choice of HTTPS transport engine,
leave the default value Use OpenSSL library selected.
9 - In Configure line ending conversions (Checkout Windows-style, commit Unix-style line endings), select the Checkout Windows-style, commit Unix-style line endings option unless you need other line endings for your work.
10 - In the Configure terminal emulator
for use with Git Bash window, select Use MinTTY (the default terminal for MSYS2).
11 - Once done, you can check the Launch Git Bash option
if you want to open a Bash command line or if you have selected the Windows command line running Git from the Windows command line.

Tip:

We strongly recommend using Git from the command line and not using a GUI. You will only use the Git interface command line to manage files. Editing can still be done through a text editor or IDE of your choice.

3 - Creat a github account and new repository

Github is free plate-forme for sharing the code, any one can create a free account : https://github.com/signupAfter creating your account, you can sign in : https://github.com/login and create a new repository: https://github.com/new

You can choose options for your repository: public or private, add or note add: REDME file... and click then on the Create repository button to create your first repository

3 - Initializing a new local git repository and push it on your online repository

Now open the cmd command and navigate to your local project by using the cd command and type:

git init

This will create a new git repository To show stats of your project file you can type:

git status

The you will see all content project in red color, you must add all by executing the following command:

git add -A

Then commit your files:

git commit -m "Initial Commit"

Now select your online repository:

git remote add origin https://github.com/youderf/myrepository.git

And then create a branch

git branch -M main

And finally push the content of your project to your online repository

git push -u origin main

 

Younes Derfoufi
my-courses.net

Leave a Reply