Starting with an Existing Project on a Server
When you're getting on board of a project that's already running, you'll want to get a copy ("clone" in Git lingo) of the project onto your local machine.
Today, many teams use a professional service to host their code repositories. If you're using one of the more popular ones (like GitHub, Bitbucket, GitLab, Microsoft Visual Studio, Perforce or Beanstalk) you can connect your service account in Tower to make cloning very easy.
Connecting a Hosting Service in Tower
Switch to Tower's Services view by clicking the little cloud icon below the toolbar. There, click the button that corresponds to the hosting service of your choice to start connecting your.
Authentication options are different for each service provider and depend on your account's settings. The Tower help documentation contains detailed instructions on this topic.
Once you've connected your account with Tower, you can clone your repositories with just a single click - without having to enter URLs or authentication credentials anymore.
Cloning from a URL
In case the remote repository is not hosted on GitHub, Bitbucket or Beanstalk, you need to clone using the project's remote URL. 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 Tower: on the Repositories view, click the "Clone" button and paste your URL, along with any authentication credentials you might have received.
In case you don't have any remote repository of your own to experiment with, feel free to clone from the following URL:
You won't need any authentication credentials and can simply use the default settings (except maybe for the location you want Git to download it on your computer).
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 be asked you for 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.