Install the latest version of git in centos6

Source: Internet
Author: User

Install the latest version of git in centos6
First update the system

  • Sudo yum update
Install dependency
  • Sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
Download and decompress the git source code
  • Https://github.com/git/git/releases
  • Tar-xzvf
Compile and install it in the "/usr/local/git" directory. (Customizable)
  • Make prefix =/usr/local/git all
  • Sudo make prefix =/usr/local/git install
Configure Environment Variables
  • Sudo vim/etc/profile or sudo vim ~ /. Bash_profile
Add the following content in the last line of the file and save and exit.
  • Export PATH =/usr/local/git/bin: $ PATH
Use git-version again to view the git version. The output indicates that the installation is successful. Set
(1) set the user name and email. Git config -- global user. name "Your Name" git config -- global user. email "youremail@domain.com", a new. gitconfig file is created in the Home directory.
Add SSH Keys to the GitHub account
You do not need to enter a password to access the SSH protocol Git server through public key authentication, and it is more secure. (When accessing the HTTP Git server, such as submitting changes, you need to enter a password each time .) (1) Create an SSH key $ ssh-keygen-t rsa-C "youremail@163.com" system will prompt the key storage location (usually ~ /. Ssh directory) and the specified password. Keep the default value and press enter three times in a row. (2) Copy the SSH Key and use vim to open the file. paste the content in the id_rsa.pub file to the Add SSH key interface of github account management. Vim ~ /. Ssh/id_rsa.pub (3) add to GitHub and log on to github-> Accounting settings icon-> SSH key-> Add SSH key-> enter the SSH key name (which can be easily distinguished by yourself ), then copy ~ /. Ssh/id_rsa.pub file content paste-> add key "button to add. (4) Test the ssh-T git@github.com
Submit changes for Repository on GitHub
(1) git clone already exists in the Repository on GitHub. (In the newly created ~ /Xxx directory) git clone https://github.com/zhchnchn/ZhchnchnTest.git (2) modify a file and then submit vim README. mdgit statusgit add README. mdgit statusgit commit-m "Edit by WorkUbuntu 1204" git statusgit remote add origin https://github.com/xxx/xxx.gitthis time will report an error: fatal: remote origin already exists. solution [3]: $ git remote rm origin after executing git remote add origin https://github.com/xxx/xxx.git (3) again, you need to push the changes to GitHub git push-u origin After the master node runs this command, the user name and password of the GitHub account are required. (4) After the submission is complete, check the Repository on GitHub and you will find that the content is modified successfully.

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.