Push your project to GitHub

Throughout this tutorial, we won’t guide you too much on using Git. For all of the code, we recommend using branches and atomic commits, as well as pushing to the remote frequently.

Not sure what to do with Git or GitHub? Check out some of the on-demand courses to learn more!

Let’s create our first commit, and push our project to GitHub :octocat:.

gif of following the directions below

Create your first commit

  1. Type git status, and see that all of your files are currently untracked in the working tree.
  2. Type git add .gitignore. This command stages our first commit using a special file called .gitignore, which lets us specify the parts of our project that should be pushed to GitHub, and those that should remain just on our machine.
  3. Type git commit -m "initial commit with gitignore" to craft our first commit.
  4. Stage the rest of the files, using git add ..
  5. Create your commit using git commit -m "add electron boilerplate files".

Push to GitHub

  1. Create a new repository on GitHub.com. To avoid errors, do not initialize the new repository with README, license, or .gitignore files. You can add these files after your project has been pushed to GitHub.
  2. Follow the steps shown in your new project for pushing an existing repository from the command line. See Tell my why if you’d like some extra resources to help you along.
Tell me why

By default, the boilerplate initialized this directory as a Git repository, so we won’t need to do any extra work to get this set up. But we did need to do a little work to get it pushed up to GitHub.com, where we can show off our code to others, and backup our work.

Understanding the .gitignore file

There’s a file in your repository named .gitignore. Git uses this to determine which files and directories to ignore, before you make a commit.

We want to use a .gitignore file built for Node projects, since Electron is a Node based project. Typically, we would do this manually. Since we used a boilerplate, this is already done. If you’re interested in learning about different .gitignore files, the github/gitignore repository contains examples for many common programming languages.

More about pushing to GitHub

Repositories can live locally on your machine, but also on a remote like GitHub.com. The steps had you push your repository to GitHub, but if you need some assistance on performing some of the steps we described, you may find the following links helpful:

  1. Adding a remote.
  2. Pushing to a remote.
Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!
Continue