A. Git introduction 1. Git is a free, open source distributed version control system for agile and efficient processing of any or small or large project. 2.Git is an open source distributed version control system for efficient, high-speed processing of project versioning from very small to very large. 3.Git is by "The Father of Linux"
Linus TorvaldsCreated by. Because he found that he could not find a satisfactory solution to manage the Linux Kernel co-developed version control, he wrote Git himself.
When it comes to dominance, then nature is relative to SVN.
- repository localization, support for offline submissions, relative independence does not affect collaborative development. Each developer has its own version control library that can execute arbitrary commit code, create branches, and so on, on its own version of the repository. For example, do developers think they have problems submitting their own code? It doesn't matter, because the repository is its own, rolling back history, repeatedly committing, merging branches doesn't affect other developers.
- Less "warehouse pollution". git will only produce one. Git directory for each project, and all version control information for this project is in this directory and will not be generated in each directory like SVN. SVN directory.
- store content as metadata and complete clone repository. All version information is located in the. Git directory, which is a cloned version of the repository on your machine that has everything on the central repository, such as tags, branches, release notes, and so on.
- supports fast switching of branches for easy merging and better consolidation performance. You can switch between different branches in the same directory, facilitate merging, and merge files faster than SVN.
- distributed repository, no single point of failure, good content integrity. The content store uses the SHA-1 hashing algorithm. This ensures the integrity of the content of the code and ensures that the repository is compromised when disk failure and network problems are encountered.
Two. Git hosting to Oschina Open source China Community official website
https://git.oschina.net/
- Opened in August 2008, the Open source Chinese community aims to provide Chinese it technicians with a comprehensive, fast-updating platform for retrieving open source software and exchanging experience with open source.
- At present, many companies in China will deploy the company's projects in
OSChina
And
GitHUB
The contrast
- Servers in China, faster
- A free account can also be set up to create
私有
a project, and a GitHUB
private project must be付费
Use
# switch directories, the first character of the directory in the Mac if '. ' indicates that the folder is hidden folder $ cd ~/.ssh# if the. ssh folder does not exist, you can execute the instruction to create the $ mkdir ~/.ssh # View current directory file $ ls
Generate RSA key pair
$ ssh-keygen-t rsa-c "Your mailbox @xxx.com" # for convenience, full return (no input RAS file name and password)
View public key content
$ cat ~/.ssh/id_rsa.pub
Copy and paste the public key contents into-oschina add public key
file:///Users/z/Library/Containers/com.tencent.qq/Data/Library/Application% 20support/qq/users/3229989970/qq/temp.db/8710e87e-fcbc-4c90-8f96-9379cd5155ba.png
- Note: Public key content starts with Ssh-rsa , the end of your mailbox, the copy can not be more than one space, not a space, format, etc. must be consistent with the generated public key
- https://git.oschina.net/profile/sshkeys
Test public key
# 测试 SSH 连接
$ ssh -T [email protected]
# terminal hint Welcome to [email protected], git nickname! ' Indicates successful connection
- Create a new project in Oschina
- Cloning a project
After configuring the Sshkey, you only need to copy the SSH link address, and then use the git command to do the relevant operation.
$ git clone [email protected]:xxx/ProjectName.git
- Note: The Oschina warehouse corresponds to a number of addresses, one is the address accessed via HTTP, and the one that is accessed via SSH here using SSH
- HTTP mode: Https://git.oschina.net/leaderlee/OC_Advanced_Prepares_Lessons.git
- SSH mode: [Email protected]:leaderlee/oc_advanced_prepares_lessons.git
Git use-third party hosting Oschina