Skip to content

Use GitHub to Manage and Share Your Code

hgeithner-creare edited this page Dec 13, 2021 · 4 revisions

Create a GitHub Account and Install GitHub Desktop

Before you can share your code with the Tympan community, first you need to create a GitHub account!

  • Navigate to github.com by clicking on the image below and follow the prompts.
  • Choose "GitHub Free." You can always upgrade later.

  • Make sure you verify your email address after signing up. The verification email will be sent to the email address used to create your account. Follow the instructions in the email.

  • Next, navigate to the GitHub Desktop installer by clicking the image below. Then, select the appropriate download link for your operating system. Follow the prompts on the screen to install GitHub Desktop.

  • With GitHub Desktop installed, now you can authenticate the application with your GitHub account. Launch GitHub Desktop and follow the steps to sign in.

Create a New Repo and Clone it to Your GitHub Desktop

  • Return to your account on github.com. In the upper-right corner of any page, use the drop-down menu, and select "New repository".

  • Give your repo a name and description, keep it public, and initialize it with a README.

  • For visual learners, follow along with the video below.

  • Now we will set up the repo on your local computer. You will copy your code here later. On github.com, navigate to the main page of the repository. Above the list of files, click "Code".

  • Click "Open with GitHub Desktop" to clone and open the repository with GitHub Desktop.

  • Choose the local file path for your repo. Select "Clone".

  • You should see your repo in GitHub Desktop now. Click "Show in Explorer" to see the exisiting files in your repo (just a README.md for now). Click "History" in the upper left corner to see past changes made in your repo.

Commit Files to Your Repo Using "Commit" and "Push"

  • Now we are going to add your code to your repo. In GitHub Desktop, click "Show in Explorer" to get the local directory of your repo.

  • Now open a new File Explorer and locate where your code is saved locally. Copy everything in your local directory and paste it in your repo directory.

  • Return to GitHub Desktop. Notice that the application has refreshed and shows the new files you added to the repo directory under the Changes heading. These changes are not saved and uploaded to the repo until you “commit” and “push” them.

  • Create a commit message in the "Summary" input. Something simple, like "Add code" is fine. Once you are happy with your changes and commit message, click "Commit to main". The changes are now saved to your local repo.

  • To upload these changes to github.com, in the upper righthand corner click "Push origin".

Edit Your "README.md" to Introduce Your Code to Others

  • On github.com, select your README.md file and edit it by clicking the pencil icon in the righthand corner.

  • This README file allows you to share with others what your code does.

  • When you are done with your changes, create a commit message (ex. "Updated README.md") and click "Commit changes".

Update Local Files Using "Pull"

  • To get the changes you just made to your README.md file locally, navigate to GitHub Desktop.

  • In the upper righthand corner click "Fetch origin". GitHub Desktop tells you there is a new commit not present on your local copy. Click "Pull origin" to get these changes on your computer.