

If the path is relative (no leading slash), then it is usually relative to the home directory of the login account on the server, though this depends on the SSH server configuration. Git will also automatically use SSH if you use the ssh URL scheme ( ssh://), or give the repository as this uses SSH to run git upload-pack on the remote side. Git supports a number of transport schemes natively to access remote repositories, including HTTP, HTTPS, its own git protocol, FTP, FTPS, and rsync. You can specify the remote repository with a URL as shown, or with a simple path to a directory in the filesystem containing a Git repository. For example, foo stays foo, but foo.git and bar/foo also become foo. If you give a second argument, Git will create a directory with that name for the new repository (or use an existing directory, so long as itâs empty) otherwise, it derives the name from that of source repository using some ad hoc rules. You can view and manipulate remotes with git remote a repository can have more than one remote with which it synchronizes different sets of branches.Īfter cloning the remote repository, Git checks out the remote HEAD branch (often master) you can have it check out a different branch with -b branch, or none at all with -n: $ git clone We call the first repository a âremoteâ (even if it is in fact on the same host), and by default, this remote is named origin you can change this with the -origin (-o) option, or with git remote rename later on.


The git clone command initializes a new repository with the contents of another one and sets up tracking branches in the new repository so that you can easily coordinate changes between the two with the push/pull mechanism.
