Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use git clone in git command

Shulou Source: shulou.com Published: 2022-06-03 11:01:51 09月21日 Update

Editor to share with you how to use git clone in the git command, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

When using git for version control, in order to get a copy of a project (copy), we need to know the address of the project repository (GitURL). Git can be used under many protocols, so GitURL may be preceded by ssh://,http (s): / /, git://, or just a user name (git will think this is a ssh address).

Gitclone usage of git command

Some repositories can be accessed through more than one protocol, for example, the source code of Git itself you can access using the git:// protocol:

Gitclonegit

It can also be accessed through the http protocol:

Gitclone

Git:// is fast and efficient, but sometimes you have to use http. For example, your company's firewall blocks your non-http access requests. If you execute either of the above two lines of command, you will see a new directory: 'git', which contains all the Git source code and history.

By default, Git removes the dropout of '.git' from the last directory name in "GitURL" as the directory name of the new clone project: (for example, .gitclone http://git.kernel.org/linux/kernel/git/torvalds/linux-2.6.git creates a directory called 'linux-2.6').

In addition, if you need a usage name and password to access a GitURL, you can add the user name before the GitURL, and add @ match between them to indicate a split, then execute the gitclone command, and git will prompt you for the password.

Gitclone example

Gitclonerobin.hu

This will be accessed as the robin.hu username and then press enter to execute the gitclone command, and git will prompt you for your password.

In addition, we can specify the branch name to be cloned with-b, such as

$gitclone-bmaster2../server.

Indicates that this branch is cloned with the name master2, and if-b is omitted, it means that the master branch is cloned.

The above is all the contents of the article "how to use git clone in the git command". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Commands directories branches can be passed password user name article project warehouse content address source code directory name prompt input excellent effective not very between Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno vpn Apple NVidia Shulou Tech Info