Go: http://blog.csdn.net/wangjia55/article/details/8818845
When using Git for versioning, to get a copy of a project, we need to know the address of the project repository (the Git URL). Git can be used under many protocols, so Git url may be ssh://, HTTP (s)://, git://, or just a username (which git would think is an SSH address) for the prefix . some warehouses can be accessed through more than one protocol, For example, the source code for git itself can be used to access the git:// protocol: Git clone git://git.kernel.org/pub/scm/git/git.git can also be visited via the HTTP protocol: git CLO The NE http://www.kernel.org/pub/scm/git/git.git git://protocol is fast and efficient, but it is sometimes necessary to use the HTTP protocol, such as your company's firewall, which blocks your non-HTTP access requests. If you With either of the above two lines, you'll see a new directory: ' Git ', which contains the Git source code and history. By default, Git removes the '. Git ' suffix of the last-level directory name in the "Git URL" as the directory name for the new clone project: (for example,. Git clone/HTTP/ Git.kernel.org/linux/kernel/git/torvalds/linux-2.6.git will create a directory called ' linux-2.6 ') In addition, if access to a Git URL requires a usage name and password, you can use the Git The URL is preceded by a user name, and with the @ match between them to represent the split, and then execute the git clone command, Git prompts you to enter the password. Example git clone robin.hu @ http://www.kernel.org/pub/scm/git/git.git This will be accessed as a robin.hu user name/HTTP// Www.kernel.org/pub/scm/git/git.git, then press ENTER to execute the git clone command, and Git will prompt you for the password. In addition, we can specify the branch name to clone by B <name>, such as Git clone -b master2 . /seRVer . Represents the clone of this branch named Master2, if you omit-B <name> represents the clone Master branch.
GIT URLS In general, URLs contain information on the transport protocol, the address of the remote server, and the path to the Repository. Depending on the transport protocol, some of this information could be absent. Git natively supports SSH, git, http, HTTPS, FTP, FTPS, and rsync protocols. The following syntaxes is used with them:ssh://[user@]host.xz[:p ort]/path/to/repo.git/git://host.xz[:p ort]/path/ to/repo.git/http[s]://host.xz[:p ort]/path/to/repo.git/ftp[s]://host.xz[:p ort]/path/to/repo.git/rsync://host.xz /path/to/repo.git/an alternative scp-like syntax may also being used with the SSH protocol: [user@]host.xz:path/to/repo.git/ The SSH and GIT protocols additionally support ~username expansion:ssh://[user@]host.xz[:p ort]/~[user]/path/to/ repo.git/git://host.xz[:p ort]/~[user]/path/to/repo.git/[User@]host.xz:/~[user]/path/to/repo.git/for Local Repositories, also supported by Git natively, the following syntaxes could be used:/path/to/repo.git/file:///path/to/repo. git/
ExamplesClone from upstream:
$ git clone git://git.kernel.org/pub/scm/.../linux-2.6 my2.6 $ cd my2.6 $ make
Make a local clone this borrows from the current directory, without checking things out:
$ git clone-l-s-n. .. /copy $ CD. /copy $ git show-branch
Clone from upstream while borrowing from an existing local directory:
$ git clone--reference my2.6 \ git://git.kernel.org/pub/scm/.../linux-2.7 \ my2.7 $ cd my2.7
Create a bare repository to publish your changes to the public:
$ git clone--bare-l/home/proj/.git/pub/scm/proj.git
Create a repository on the kernel.org machine this borrows from Linus:
$ git clone--bare-l-s/pub/scm/.../torvalds/linux-2.6.git \ /pub/scm/.../me/subsys-2.6.git