DEV Community

Iniobong Ema
Iniobong Ema

Posted on

GIT AND GITHUB

What is Git?
Git is a popular version control system. It was created by Linus Torvalds in 2005, and has been maintained by Junio Hamano since then.

Git is used for:
1) Tracking code changes
2) Tracking who made changes
3) Coding collaboration

GitHub is a proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug tracking, software feature requests, task management, continuous integration, and wikis for every project.

To run git on your system;

This is the dashboard of Github
Image description

1) HOW TO SET IT UP

  • To achieve this, on your windows search bar, type git and select Git Bash

Image description

click on 'open' to see this

Image description

From here, lets do a Git Configuration
That is the Username, email address as shown below

Image description

Type ls to know the directory you are currently,

Image description

To check for Documents, type cd Documents

Image description

To create a folder, make a directory with this command, 'mkdir git-lab' as shown below:

Image description

To be sure of this folder, go to file explorer, document to see if the folder is there,

Image description

Open it to be sure it's empty,

Image description

Go to git Bash to run a git in the folder created
type 'cd git-lab'

Image description

The first git command I'm about to run is 'git init'

Image description

There is a .git folder created now with some files in it;

Image description

This means that I have successfully initialized git in my local machine

Next is to create a file called 'touch readme.md'

Image description

Next is to create a file called 'nano readme.md'. It will take you to a fresh page, type 'THIS IS MY FIRST REPOSITORY', then 'control and x' then 'y' for yes

Image description

Click on enter to exit the page, this will be displayed

Image description

The next command I will run is the 'cat readme.md'

Image description

The next command I will run is the 'git status'

Image description

The next command I will run is the 'git add readme.md'

Image description

The next command I will run is the 'git status'

Image description

2) TO CREATE A COMMIT
The next command I will run is the 'git commit -m "Adding a readme file'

Image description

3) TO CREATE A REPOSITORY
Go to your browser, click on the + sign in your github page to create a new repository

Image description

Give a name to the repository
then click on 'create'

Image description

Scroll down to click on 'create'

Image description

The repository is created as shown below;

Image description

Copy the highlighted command

Image description

Run the copied command on a browser

Image description

4) TO CREATE A GIT-PUSH
The next command I will run is the 'git push -u origin master'
The page below will be displayed

Image description

Click on 'sign in with a browser' as shown

Image description

The page below will be displayed

Image description

Click on 'Authorize Git Ecosystem' The page below will be displayed

Image description

Insert your password and click on 'confirm'
Once your password is confirmed, 'Authentication succeeded will be displayed'

Image description

The following command will be displayed on your git bash

Image description

Top comments (1)

Collapse
 
iniobong_ema_92e60ed18028 profile image
Iniobong Ema

Great