Install Git under Linux (CentOS) and upload code in a few steps (personally verified steps)

Source: Internet
Author: User
Tags using git

I've heard of GitHub many times before, but it's not until recently that I learned to use GitHub to host my own code under Linux! To tell the truth, I myself in the use of the time from the online search a lot of tutorials, but always feel difficult to master (step too cumbersome), the time of their own operation is quite complicated! (To be honest, it is not enough to understand) but finally, through his own groping, learned to load GitHub and use the command to upload code for hosting.

First, before using Git to host your own code, go to the GIT official website to register an account (the process of registration can refer to the Tutorial guide) steps are as follows:

(1) Login URL: https://github.com Fill in the user name, email, password, click on Sign up can be simple registration. such as


(2) Complete the registration, go to the GitHub platform, click on new repositories, create a new project (e.g.)

(3) To create a new project, enter the name of the project you want to upload, all of the options are available by default, and the creation succeeds by clicking Create.

in this case, the pre-work has basically been completed and the next step is to install git under CentOS:

(1) Go directly to root, install the command: Yum install git (installed to the back of the time when you encounter the option of all the default key Enter)

(2) Use command: Ssh-keygen-t rsa-c "[email protected]" To get the key (the mailbox here is the same as the GIT official online registration), enter the/root/.ssh directory, find a rsa.pub file, execute the command: VIM Rsa.pub, copy all of the contents.

(3) Re-enter the GIT website and create an SSH key by filling in the text box with the content you just copied, which is used to secure the managed code.


Here is the operation of managed code under Linux:

The git version that you just installed in CentOS can be viewed via the command git--version, which can be seen in the 1.7 series, which is limited by the git command, with the highest version only to the 1.7 series. I'm here to raise this because in this version of the managed code will be too low because the version of the upload is not successful, (the general error is: HTTP request failed, you can try it), so you want to upgrade the GIT version by command.

(1) The steps to upgrade the GIT version to the 2.0 series are: (Of course, these steps come from an online tutorial, just follow the steps below)

Installation Requirements

# yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum Install gcc Perl-extutils-makemaker

Uninstall the git1.7.1 from CentOS

Looking at the version of the system with Git–version, Cento6.5 should have a git version that is 1.7.1

# yum Remove git

Download the git2.1.2 and add git to the environment variable

Download git latest version

# CD/USR/SRC
# wget https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz
# tar Xzf git-2.1.2.tar.gz

Install Git and add it to environment variables

# CD git-2.1.2
# Make Prefix=/usr/local/git All
# Make Prefix=/usr/local/git Install
# echo "Export path= $PATH:/usr/local/git/bin" >>/ETC/BASHRC
# SOURCE/ETC/BASHRC

View version number

# git--version git version 2.1.2 (can succeed) (2) go to the root directory of the project you want to host (operate as follows, take one of my own projects as an example)

1. Create a file first: Touch readme.md

2. Execute the following command at a time








Now that the managed project is successful, you can go to your git and check it out!







Install Git under Linux (CentOS) and upload code in a few steps (personally verified steps)

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.