Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.87 KB

File metadata and controls

69 lines (45 loc) · 1.87 KB

Lab3.2: Pushing code to GitHub

What am I about to learn?

  • We will learn how to push our code to a GitHub repo!

For this tutorial, you will need to download and install GitHub on your local computer.

Lab 3.2: Step by step guide

  1. Set up your GitHub account, select a repo name and create the new repository.

image-20220125125003569

  1. Copy the HTTPS URL.image-20220125125003569

  2. We are now ready to push our code to the repo! Open a terminal or a powershell. Make sure GitHub is installed using the next command.

$ git --version
git version 2.34.1
  1. Configure your user name and email as follows (use your GitHub username and email). These are the commands that you need to run.
$ git config --global user.name "Stelios"
$ git config --global user.email youremail@domain.com
  1. Now move to your app folder. You can run the next commands in your VSC terminal while you are in your node.js project app folder.
$ git init	
  1. Add the GitHub repo as the origin.
$ git remote add origin https://github.com/steliosot/cc.git
  1. Before you push the data, we will need to make sure that we don't push the .env file! For the moment, make sure you delete the DB connection string from your .env file. We will see soon how to use the .gitignore files to help us with this.
  2. Add all the files.
$ git add . 
  1. Commit the changes (with a message)
$ git commit -m "Pushing my app files"
  1. Upload the files in the repository.
$ git push -f origin main
  1. Done! You should be able to see your file online