Retaining your GitHub code

  1. Overview
  2. READ THIS!
  3. Obtaining copies of the GitHub repo
  4. Publishing a copy of your class repo to a personal GitHub repo
    1. Publishing the repo

Overview

This page contains instructions for copying your class project GitHub code to a GitHub repository of your own for your keeping.

READ THIS!

Many projects have secret keys or passwords that are used to connect to database or access web services, e.g., Firebase, Google Maps, Cloud Functions, Amazon, and generally any API.

If you create a public GitHub repository to keep a copy of your class project, you must:

  1. Delete the files containing sensitive information BEFORE you push! You should load such secrets from environment variables or config files that are ignored by .gitignore. However, these files will still be visible in your commit history, so…
  2. Regenerate the keys and passwords you use in any published software to something else.

A malicious user can (and will) find your keys on GitHub. This will use up your API limits and/or run up a bill on you.

Obtaining copies of the GitHub repo

First, git pull your project repo. You want to be up to date. The directory is on your computer and will remain there until you delete it. You could just zip up the folder and be done.

Publishing a copy of your class repo to a personal GitHub repo

Again, if you have folders on your machine, and all you care about is having the files, you are done. But if you want to have a copy on GitHub, follow the steps below.

Publishing the repo

  1. Log in to https://github.com
  2. Create a new repository and name it what you choose. Select “Private” if that option is available, and “Public” otherwise. Do not initialize the repository with README, gitignore, or a license.
  3. Copy the new repository’s URL, e.g., https://github.com/llayman/copy-of-project.
  4. In a Terminal with access to git tools, use cd to navigate into the local repo folder. Run the commands:
    git pull
    git remote add copy https://github.com/llayman/copy-of-project  # replace with your new repo's URL
    git push -u copy
    
  5. You should now be attached to your private copy’s remote, and you should see the code on GitHub.