DEV Community

Cover image for Stacky REST API #4 - Push Project to Github

Stacky REST API #4 - Push Project to Github

mr_steelze profile image Odunayo Ogungbure ・2 min read

GitHub is a web service that helps developers store, track and control changes to their code.

What Is GitHub, and What Is It Used For?

Ensure to have git installed and setup on your machine. You can download git here.

Visit Github and create an account or sign in if you already have one and then create a new repository called stacky.


Head back to our project, open up the terminal and initialize an empty git repository;

$ git init
Enter fullscreen mode Exit fullscreen mode

Add a .gitignore file at the root of our project. A .gitignore file specifies which files and folders should be ignored in a given source code. This means this files and folder will not be pushed and tracked by git.

Enter fullscreen mode Exit fullscreen mode

Notice we added our .env file to be ignored because the .env file usually contains sensitive or localized information. In the case of sensitive information, like API keys, authentication keys and so on, we won't want these sitting in version control where they can be publicly accessed.

But then how do any user who pulls our projects knows what environment variables needs to be set. Simple, let's add a .env.example file and as the name implies this is just an example file which users can then use to create their .env file. So let's add this file to the root of our project.

Enter fullscreen mode Exit fullscreen mode

Next, we need to stage and commit our changes;

$ git add .
$ git commit -m"First commit"
Enter fullscreen mode Exit fullscreen mode

Back to the Github screen on the browser, scroll down to the "... or push an existing repository from the command line" and copy the commands into your terminal.


Head to your GitHub repo and you should see your codes in the main branch.

Heads up: If you have a previous version of git installed on your system, your default branch might be master.


Editor guide