GitHub Online Repository

Source: Internet
Author: User
Tags version control system

GitHub is a software development project that uses Git's version control system as a Web-based hosting service. It also has its standard GUI application available for download (in Windows,mac,gnu/linux) directly from the service's website. But in this session, we will only see the CLI section.

Create a GitHub repository

Go to github.com. If you already have a GitHub account, then sign in with that account, or create a new. Follow these steps to create a new repository from the Github.com Web site.

Push operations

Tom decided to use the server on GitHub. To start a new project, he will create a new directory and a file inside.

[[Email protected]]$ mkdir github_repo[[email protected]]$ cd github_repo/[[email protected]]$ VI hello.c[[email protected]]$ make Hellocc hello.c-o hello[[email protected]]$./hello

The above command produces the following results.

Hello, World!!!

After validating his code, he submits his changes locally in the initialization directory with the GIT init command.

[[Email protected]]$ git initinitialized empty git repository in/home/tom/github_repo/.git/[[email protected]]$ git stat Us-s?? Hello?? Hello.c[[email protected]]$ git add hello.c[[email protected]]$ git status-sa hello.c?? Hello[[email protected]]$ git commit-m ' Initial commit '

After that, he added GitHub's repository URL as a remote origin and pushed him to the remote repository.

Note: We have discussed all these steps under Chapter 4th Creating the Bare Library section.
[[Email protected]]$ git Remote add origin https://github.com/kangralkar/testing_repo.git[[email protected]]$ git push- U Origin Master

The push operation asks GitHub for the user name and password. After the validation succeeds, the operation succeeds.

The above command produces the following results.

Username for ' https://github.com ': Kangralkarpassword for ' https://[email protected] ': 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 set up to track remote Branch master from Origin.

From now on, Tom can make any changes in the GitHub library. He can use all the commands discussed in this chapter in the GitHub repository.

Pull operation

Tom succeeded in putting all his changes on GitHub's library. Other developers can now view these changes for cloning operations or to update their local repositories.

Jerry uses the git clone command to create a new directory in his home directory and in the cloned GitHub library.

[[Email protected]]$ pwd/home/jerry[[email protected]]$ mkdir jerry_repo[[email protected]]$ git clone https:// Github.com/kangralkar/test_repo.git

The above command produces the following results.

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

He validates the directory content by executing the LS command.

[Email protected]]$ lstest_repo[[email protected]]$ ls test_repo/hello.c

GitHub Online Repository

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.