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.
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
|
Open GitHub site github.com as prompted to register, free of charge
First, to generate the public key
?
|
1
|
# ssh-keygen -t rsa -C "你注册github所用的邮箱地址"
|
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
?
|
1
2
|
# git config --global user.name "用户名"
# git config --global user.email github注册的邮箱地址
|
When configured, perform the following command checksum
|
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.
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
|
?
|
1
2
|
[root@localhost
test
]
# git init
Initialized empty Git repository
in
/root/test/
.git/
|
?
|
1
|
[root@localhost
test
]
# echo "这是一个测试的案例" > README.md
|
|
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
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.