git command installation and GitHub simple to use

Source: Internet
Author: User
The advent of git has put traditional svn in an awkward position, with distributed versioning being needed, and SVN, which is currently known to support distributed, is still a cloud. Here's an example of installing git with simple and practical GitHub.
Installation
The simplest, you can download the resource bundle directly, and then install the good, if it is CentOS, you can use the Yum command installation:
?
1
# yum install git git-gui
Register GitHub
Open GitHub site github.com as prompted to register, free of charge
Import Public key
First, to generate the public key
?
1
# ssh-keygen -t rsa -C "你注册github所用的邮箱地址"
View Public Key
?
1
# cat ~/.ssh/id_rsa
Copy it, then click the Set button in the upper-right corner of GitHub
Click on the SSH keys entry on the left menu bar to open the SSH Keys admin page and click Add SSH key on the key Admin page to add the public key
In the pop-up dialog, the title is filled in, the key bar copies the public key you created on the Linux machine
Account Configuration
?
1
2
# git config --global user.name "用户名"
# git config --global user.email github注册的邮箱地址
When configured, perform the following command checksum
?
1
# ssh git@github.com
If prompted:
?
1
2
3
PTY allocation request failed on channel 0
Hi lizhong8532! You've successfully authenticated, but GitHub does not provide shell access.
                                                                                             Connection to github.com closed.
Represents a validation pass.
Create GitHub Warehouse
We create a test warehouse
Copy test warehouse ssh git address, submit need to use
Create a project directory
?
1
2
[root@localhost ~] # mkdir test
[root@localhost ~] # cd test
Class
?
1
2
[root@localhost test ] # git init
Initialized empty Git repository in /root/test/ .git/
Creating README.MD Files
?
1
[root@localhost test ] # echo "这是一个测试的案例" > README.md
Submit to Local
?
1
2
Div number3= "" index2= "" > 3
4
[root@localhost test ] # git Add.
[root@localhost test ] # git commit-m "first commit"
[Master (root-commit) C9206DC] First commit
  1 files changed, 1 insertions (+), 0 deletions (-)
  Create mode 100644 readme.md
where git Add. The point in is to submit all files under this project, or you can specify the file directly git add readme.md
Submit to GitHub
Above, just submit to the local version of the library, the GitHub warehouse has no files, now submitted to the GitHub
?
1
2
3
4
5
6
7
8
[root@localhost test ] # git remote add origin git@github.com:lizhong8532/test.git
[root@localhost test ] # git push -u origin master
Counting objects: 3, done .
Writing objects: 100% (3 /3 ), 255 bytes, done .
Total 3 (delta 0), reused 0 (delta 0)
To git@github.com:lizhong8532 /test .git
  * [new branch]      master -> master
Branch master set up to track remote branch master from origin.
Among them, Git@github.com:lizhong8532/test.git is my test warehouse submission address, you need to change to your test warehouse address.
Then refresh your warehouse and you'll see the file you just submitted.

 

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.