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 hosting website

As a well-known online project code hosting website, 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

Next we will talk about how to use the GIT version control system on the Google Code website to manage our project code.

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' searches for suitable indexes.After entering the information, click "Create Project" to complete the project creation.

3. 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.
GitHub 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.com login yanghui1986527@gmail.com Password
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 init
Git 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-V

Origin SSH: // git @ snowdream/Library-Books.git (FETCH)

Origin SSH: // 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-V

Googlecode https://code.google.com/p/library-books/ (FETCH)

Googlecode https://code.google.com/p/library-books/ (push)

Origin SSH: // git @ snowdream/Library-Books.git (FETCH)

Origin SSH: // 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.