Git Create Warehouse "Go"

Source: Internet
Author: User
Tags git commands

transferred from: http://www.runoob.com/git/git-create-repository.htmlGit Create Warehouse

In this section we will show you how to create a Git repository.

You can use a directory that already exists as a git repository.

Git init

git uses the git init command to initialize a git repository, and many git commands need to be run in a git repository, so git init is the first command to use Git.

After executing the git init command, the GIT repository generates a. Git directory that contains all the metadata for the resource, and the other project directories remain the same (unlike SVN, which generates. SVN directory in each subdirectory, git only generates the. git directory in the repository's root directory. )。

How to use

Using the current directory as a git repository, we just have to initialize it.

Git init

When the command finishes executing, a. Git directory is generated in the current directory.

Use our designated directory as a git repository.

Git init newrepo

After initialization, a directory named. Git will appear in the Newrepo directory, and all of the data and resources that git needs are stored in this directory.

If there are several files in the current directory that you want to include in version control, you need to first tell Git to start tracking the files with the git add command and then commit:

*.  -' Initialize project version ' 

The above command submits the directory under the. C End and the README file to the repository.

git clone

We use git clone to copy items from an existing Git repository (like svn checkout).

The command format for the Clone warehouse is:

<repo>

If we need to clone to the specified directory, you can use the following command format:

<repo><directory>

Parameter description:

    • Repo: Git Repository.
    • directory: local directory.

For example, to clone the Ruby language Git code repository Grit, you can use the following command:

$ git clone git://github.com/schacon/grit.git 

After the command is executed, a directory named Grit is created under the current directory, which contains a. git directory that holds all the downloaded version records.

If you want to define a new project directory name yourself, you can specify a new name at the end of the command above:

$ git clone git://github.com/schacon/grit.git mygrit 

Git Create Warehouse "Go"

Related Article

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.