Starting with an Existing Project on a Server
When you're getting on board of a project that's already running, you were probably given a URL to the project's remote repository on a server. Such a URL can take many forms:
ssh://user@server/git-repo.git
user@server:git-repo.git
http://example.com/git-repo.git
https://example.com/git-repo.git
git://example.com/git-repo.git
No matter what format the URL is, you can just pour it into the "git clone" command. However, you should first make sure that you are in the folder where you want this project to be downloaded to:
$ cd your/development/folder/
$ git clone https://github.com/gittower/git-crash-course.git
Note
In case you don't have any remote repository of your own to experiment with, feel free to clone from the above URL. I'll use this repository in my examples for the rest of this book.
Git will now download a complete copy of this repository to your local disk - on condition that you're allowed to access this repository.
- For the "http" and "git" protocols, no access rights are necessary.
- For "https" URLs, you might need a username and a password.
- For "ssh" URLs (either with a leading "ssh://" or, with the shorter form, "user@server..."), you'll have to use "SSH Public Key" authentication. While being very safe, efficient, and widely used, it's also a little bit of work to set up. For detailed information about this topic I recommend taking a look at chapter "Authentication with SSH Public Keys" later in this book.