Git use-third party hosting Oschina

Source: Internet
Author: User
Tags hosting version control system

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.

    1. 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.
    2. 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.
    3. 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.
    4. 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.
    5. 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 inOSChina
And GitHUBThe contrast
    1. Servers in China, faster
    2. A free account can also be set up to create 私有 a project, and a GitHUB private project must be付费
Use
    • Registered account

      • recommended not to use QQ mailbox, use QQ mailbox may not receive verification mail
    • Add SSH Public key, enter terminal, and enter the following command

      • or view open source China help document address: https://git.oschina.net/oschina/git-osc/wikis/help #ssh-keys    
    • li>

      Enter the. SSH directory

        # 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
    • Add togitignore

      # /Users/NJ-Lee/Desktop/gitignore-master/ 是保存 gitignore 的目录$ cp /Users/NJ-Lee/Desktop/gitignore-master/Swift.gitignore .gitignore$ git add .$ git commit -m"添加gitignore"$ git push
    • Tips:

      • You can https://github.com/github/gitignore get the latest version of the gitignore file from
      • Once a file is added .gitignore , individual project settings (e.g., last open files, debug breakpoints, etc.) are not submitted to the server for each commit, which is important in team development
      • If phrase is not configured to add a warehouse to Xcode, the SSH Keys Passphrase column will be empty and add will be successful.
      • If you have any questions, please send me a message or email [email protected] contact me

Git use-third party hosting Oschina

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.