Online Repository in Git

GitHub is a social network for programmers for software development projects using git revision management system. It also has a standard GUI application for direct download (Windows, Mac, GNU / Linux) to your computer from web sites. But in this tutorial, we only consider the CLI section.

GitHub is a social network for programmers for software development projects using git revision management system. It also has a standard GUI application for direct download (Windows, Mac, GNU / Linux) to your computer from web sites. But in this tutorial, we only consider the CLI section.

Create GitHub repository

Go to github.com. If you already have a GitHub account, then log in to the system with your account or create a new account. Follow the steps in github.com to create a new repository.

Push operation

Tom decided to use GitHub server. To start a new project, he creates a new folder and a file in it.

 [tom @ CentOS] $ mkdir github_repo 

[tom @ CentOS] $ cd github_repo /

[tom @ CentOS] $ vi hello.c

[tom @ CentOS] $ make hello
cc hello.c -o hello

[tom @ CentOS] $ ./hello

The above command will produce the following result:

 Hello, World !!! 

After verifying his code, he starts working with the directory with the git init command and commits his internal changes.

 [tom @ CentOS] $ git init 
Initialized empty Git repository in /home/tom/github_repo/.git/

[tom @ CentOS] $ git status -s
?? hello
?? hello.c

[tom @ CentOS] $ git add hello.c

[tom @ CentOS] $ git status -s
A hello.c
?? hello

[tom @ CentOS] $ git commit -m 'Initial commit'

After that, he adds GitHub repository URL as a remote control and pushes his changes to this remote repository.

 [tom @ CentOS] $ git remote add origin https://github.com/kangralkar/testing_repo.git 

[tom @ CentOS] $ git push -u origin master

Push operation will require user account and password on GitHub. After successful login, push operation will be successfully performed.

The above command will produce the following result:

 Username for 'https://github.com': kangralkar 
Password for 'https: //kangralkar@github.com':
Counting objects: 3, done.
Writing objects: 100% (3/3), 214 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/kangralkar/test_repo.git
* [new branch] master -> master
Branch master được đặt vào trình phục vụ người dùng xa từ origin.

Starting now, Tom can push any changes to the GitHub repository. He can use all the commands mentioned in this tutorial with the GitHub repository.

Pull activity

Tom has successfully pushed all the changes to the GitHub repository. Now, other programmers can observe those changes by performing a simulation operation or updating their local repository.

Jerry creates a new folder in the home directory and simulates the GitHub GitHub repository using the git clone command.

 [jerry @ CentOS] $ pwd 
/ home / jerry

[jerry @ CentOS] $ mkdir jerry_repo

[jerry @ CentOS] $ git clone https://github.com/kangralkar/test_repo.git

The above command will produce the following result:

 Cloning into 'test_repo' . 
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 3 (delta 0)
Unpacking objects: 100% (3/3), done.

He verifies the directory contents by running the ls command.

 [jerry @ CentOS] $ ls 
test_repo

[jerry @ CentOS] $ ls test_repo /
hello.c

According to Tutorialspoint

Last lesson: Stash operation in Git

Next lesson: Operating Rename in Git

Update 25 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile