Simple tutorial on using git version control system on Google Code project code hosting website

Source: Internet
Author: User
Tags git client mercurial using git website hosting hosting website
ArticleDirectory
    • 1. Register a Google account
    • 2. Create a new project (use git for Version Control)
    • Iv. Project Management
    • 5. expand knowledge

Original article address: simple tutorial on git version control system on Google Code project code hosting website

 

As a famous online projectCodeWebsite hosting. Google Code currently supports three major version control systems: git, mercurial, and subversion. Subversion, that is, SVN, is already familiar to everyone. Here we will introduce the recently added git version control system. If your project on Google Code has used SVN for version management, you can also easily use git locally to manage the project version. For detailed operation steps, see:Convert your project from subversion to git

 

1. Register a Google account

To use Google Code for project code hosting, you need a Google account first. If you do not have one, please register one through the following link; otherwise, skip this step. Register a Google account: https://www.google.com/accounts/NewAccount? Hl = ZH-CN

 

2. Create a new project (use git for Version Control) 1. First, go to the Google Code hosting homepage: http://code.google.com/hosting/, and click "Create a new project" to go to the new project creation page. 2. Here we take the library-books project as an example. This project is mainly used to manage some original notes written at ordinary times. The Project Creation instructions are as follows: Project name: Library-books // project name Project Summary:Library-books // project overview, which can be summarized in one sentence
Description:Library-books // project description, which can be described in more detailMain project content Version Control System: git // version control system. Here we select git Source code license: gnu gpl V3 // code protocol selection. Here we chooseGnu gpl v3 Project label (s): books, opensource // project label. It is mainly used as a project keyword to facilitate others' search. After completing the index, click "Create Project" to complete the project creation. Iii. Project Settings 1. Click to enter the Google Code Management settings page: setting page: https://code.google.com/hosting/settingsrecord googlecode.com password, which will be used later. 2. Find the following options in the "user preferences" field:
Security

 Accept yanghui1986527@gmail.com Google account password when using a git or Mercurial client. To make sure your password is safe, always use the latest client from:

    • Http://git-scm.com/download
    • Http://mercurial.selenic.com/downloads/

Select this option to ensure that you can log on to Google Code for version management through the GIT client.

4. Project Management 1. Go to the Project Management Homepage and click "Source-checkout" to go to the checkout page. There are two ways to access the project code: Option 1: switch to the working directory, enter the following code on the terminal, and check out the empty repository.
 
Git clone https://Yanghui1986527@code.google.com/P/Library-books/

Option 2: maintain access authorization by creating a. netrc file.Create the. netrc file in the home directory and add the following code to the. netrc file:

 
Machine code.google.comLoginPassword yanghui1986527@gmail.com

Note: For Password, refer to the third step.

Here we use the second method to avoid frequent input of complex passwords. 2. Switch to the working directory and enter the following code on the terminal to check out the empty repository.
 
Git clone https://Code.google.com/p/library-books/

 

3. Create a project in the empty warehouse and complete the project. After the project is complete, switch to the project directory and enter the following command to push the project to Google Code.
 
Git push orgin -- all

 

5. extended knowledge 1. How to push existing projects to Google Code? A: switch to the project directory, initialize git, and submit the code.
 
Git initgit Add. Git commit-A-m"Initial Branch"

Then add the Google Code Remote Repository

 
Git remote add origin https://Code.google.com/p/library-books/

Finally, push the project code to Google Code.

 
Git push orgin -- all

 

2. If my project code is hosted in a local repository, how can I host the project on Google Code? A: switch to the project directory, and enter the following command to display the remote Repository:

 
Snowdream @ snowdream :~ /Workspace/git/Library-books $ git remote-Voriginssh://Git @ snowdream/Library-Books.git (FETCH)Originssh://Git @ snowdream/Library-Books.git (push)

We can see that the project is hosted in a local repository. Next, run the following command to add the Google Code Remote repository.

 
Git remote add googlecode https://Code.google.com/p/library-books/

Note: The googlecode in the command is the repository alias and can be customized.

The remote repository is displayed again, as shown below:

Snowdream @ snowdream :~ /Workspace/git/Library-books $ git remote-Vgooglecodehttps://Code.google.com/p/library-books/ (FETCH)Googlecodehttps://Code.google.com/p/library-books/ (push)Originssh://Git @ snowdream/Library-Books.git (FETCH)Originssh://Git @ snowdream/Library-Books.git (push)

Finally, push the project code to Google Code.

 
Git push googlecode -- all

 

3. I am not familiar with the GIT version control system. How can I learn how to use the GIT version control system? A: You can learn how to use the GIT version control system through the following online tutorials:

Pro git Chinese version: http://progit.org/book/zh/

Git magic Chinese version: http://www-cs-students.stanford.edu /~ Blynn/gitmagic/Intl/zh_cn/

Git reference English: http://gitref.org/

Git documentation http://git-scm.com/documentation

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.