If you do choose to use SourceTree as a GUI Git client, you'll need to add your GitHub credentials to SourceTree. Let's do that now.
- Open the SourceTree app.
- Click the "Gear" icon in the top right corner and select "Settings"
- Click "Add Account"
- Hub: Select "GitHub"
- Username: (Enter your GitHub username)
- Password: (Enter your GitHub password)
- Protocol: Select "SSH"
- Click "OK"
- Click "Close"
- Click the "Remote" tab to see your repositories
Now, you can click "Clone" to clone one to your local machine. I'll clone the "My-First-GitHub-Site" to my local machine with SourceTree.
Cloning a Repo to Your Local Machine
- Click the "Clone" link next to "My-First-GitHub-Site" (or the repo you'd like to clone)
- Source URL: (Leave this at its default. If you change it the clone won't work.)
- Destination Path: (This is the location on your computer that you'd like the repo to be cloned to.)
- Name: (This is the name of the bookmark that represents the repo in SourceTree)
- Click "Clone"
The repo will be cloned to your local machine and should open in a new window when it's done. If it doesn't, double click on the bookmark in the list in the "Local" tab.
Deleting a Repo from SourceTree
Since this was just a test repo, I'll delete it from my machine.
- Right click on the bookmark
- Select "Delete" (When you do that, you'll be asked whether you'd just like to remove the bookmark from SourceTree and leave the repo on your machine, or also move the repo to the Trash. Since this was just a test repo, I'll move it to the trash.)
- Click "Also Move To Trash"
Adding an Existing Repo that Has a Corresponding Remote to SourceTree
For some reason if you click "Clone" next to a repo you already have on your local machine and select the existing directory, it won't connect the remote repo with your existing copy. You can either clone it to a new location, or add the directory manually in the Local tab. I'll add my existing project manually.
- Click "New Repository"
- Click "Add existing local repository"
- Navigate to your repo
- Click Open
Once that's done, you can double click the new bookmark and use SourceTree as you normally would. To verify that it is connected to the remote on GitHub, click the "Settings" gear in the top right-hand corner and you should see the GitHub remote in the "Remotes" section.