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.
Get our popular Git Cheat Sheet for free!
You'll find the most important commands on the front and helpful best practice tips on the back. Over 100,000 developers have downloaded it to make Git a little bit easier.
About Us
As the makers of Tower, the best Git client for Mac and Windows, we help over 100,000 users in companies like Apple, Google, Amazon, Twitter, and Ebay get the most out of Git.
Just like with Tower, our mission with this platform is to help people become better professionals.
That's why we provide our guides, videos, and cheat sheets (about version control with Git and lots of other topics) for free.