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"