Setting Up GitHub Desktop & Creating Our First Repository

Note: This section assumes you already have an account on GitHub. If not, follow the steps outlined in “Creating Your First Repository on GitHub” section in Lesson 3, “Using GitHub for Version Control”.

Screenshot GitHub Desktop welcome screen.
Screenshot GitHub Desktop welcome screen.

Click the Sign in to GitHub.com button. This will open a browser window where you can use your GitHub credentials to log into GitHub. If you have not already logged into GitHub in your browser, you will be presented with the following window.

Screenshot of Browser showing sign into GitHub to continue to GitHub Desk screen.
Screenshot of Browser showing sign into GitHub to continue to GitHub Desk screen.

Enter your credentials and click the green Sign in button to access the select user page. Note: If you are signed into GitHub.com in your browser, you will be taken directly to the select user page.

Screenshot of Browser asking for confirmation of user to authorize GitHub Desktop.
Screenshot of Browser asking for confirmation of user to authorize GitHub Desktop.

Click the green Continue button for the user you want to use with GitHub Desktop.

Screenshot of browser detailing privileges granted to GitHub Desktop
Screenshot of browser detailing privileges granted to GitHub Desktop

Next, you will be asked to authorize GitHub Desktop with your GitHub account and allow access to all repositories, your data on GitHub, and workflows. Click the Green Authorize desktop button to continue.

Screenshot of browser asking for permission to open GitHub Desktop
Screenshot of browser asking for permission to open GitHub Desktop

You will be asked if you want to allow the website to open GitHub Desktop. Click Allow or Always Allow based on your preferences. GitHub Desktop should appear after clicking Allow.

Screenshot of GitHub Desktop Configure screen asking for name and email address
Screenshot of GitHub Desktop Configure screen asking for name and email address

Here you are asked to configure the name and email to use when creating commits. You can use the information that is already stored in your GitHub account or provide a name and email address to use. This information will be used commit messages.

This screen is equivalent to the following command line git statements.

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

Click the blue Finish button to continue.

Creating Your Homework Repository

Screenshot of GitHub Desktop Let's Get Started screen with buttons to create or clone a repository
Screenshot of GitHub Desktop Let's Get Started screen with buttons to create or clone a repository

After providing a user name and email address, GitHub Desktop provides the options to create repositories, clone a repository from the Internet, or add existing repositories from your local drive. Click the Create a New Repository on your Local Drive… button.

Screenshot of GitHub Desktop Create Repository screen with fields for repository information
Screenshot of GitHub Desktop Create Repository screen with fields for repository information

On the Create a New Repository dialog, you can give your new repository a name, description, and local path on your computer. The Name and Local Path fields are required; all other fields are optional. In the screenshot above, the “Initialize this repository with a README” option is checked, and the “Git Ignore” field contains “Swift”. The README file is a Markdown file that provides details of the repository, and the .gitignore is a file that tells Git what files to ignore in the project. These files are typically temporary or preference files that are not required for building the project. Click the blue “Create Repository” button to continue.

This screen is equivalent to creating a folder for your repository and initializing it. Adding a .gitignore, license will need to be done manually.

mkdir myCoolApp
cd myCoolApp
git init

Publishing the Repository to GitHub

Finally, we arrive at the repository info screen. At the top of the window, we see the currently open repository. In this case, it is the repository we created in the last step. After the current repository, the current branch is listed. When a new repository is made, there is only one branch, main. After the current branch, there is an action to publish the repository to GitHub.

Screenshot of GitHub Desktop Publish Repository dialog
Screenshot of GitHub Desktop Publish Repository dialog

Currently, our repository is only on our local machine. Clicking ‘Publish repository’ will create a remote repository on GitHub and link it as a remote in our local repository.

When clicking Publish repository, a dialog will appear with the name and description fields prepopulated with the local repository’s name and description. They can be set to different values; however, it is good to keep them the same to prevent confusion later on. The Keep this code private option is checked by default. This will make the remote repository private. Private repositories will not appear in search results and can only be accessed by users who have been granted access to the repository. We recommend that you keep your homework repository private throughout the boot camp.

Clicking the Publish Repository button will create the remote repository on GitHub, and you will see some changes in GitHub Desktop.

Screenshot of GitHub Desktop Repository screen after publishing to GitHub
Screenshot of GitHub Desktop Repository screen after publishing to GitHub

You will note that the button for ‘Publish repository’ has been changed to ’Fetch origin’. Fetch origin will get the latest changes from the remote repository (named origin by default). When working with a team, you will want to update your branch with the latest changes before pushing your changes to the remote repository.

The steps are the equivalent of creating a repository on GitHub and using the URL for the repository to set the local repository’s remote and pushing the local commits to the remote.

git remote add origin <remote_repository_URL>
git push -u origin main

Let’s review what we have done.

  • Created a new local repository on our machine
  • Created a remote repository on GitHub and linked it as a remote in our local repository

Next we will create a branch for our homework.

See forum comments
Download course materials from Github
Previous: Downloading & Installing GitHub Desktop Next: Creating a Branch for Homework Assignments