How to Create and Add Code to a New Github Repository

Image for post
Image for post
  1. Create a new repository in Github by clicking the plus sign in the top right corner of your Github page and clicking “New repository” from the dropdown menu. This will bring you to a new page where you can specify a name for the new repository, write a description, and add additional information and content, like a Read Me.
Image for post
Image for post

2. Now that you have a repository go to your terminal and change the current directory to your project.

3. Initialize your directory as a Git repository by running the following code in your terminal. This initializes the repository with main as the default branch.

4. Add the files in new local repository and stage them to be committed by running the following code in your terminal.

5. Commit the files you just staged by running the following code in your terminal.

6. In your terminal run the following code. The remote URL is the URL for the Github repository for this project. You can get this link by clicking the “Code” button in your Github repository. This will open a tooltip with your URL.

Image for post
Image for post

7. Once you have added your remote origin you can verify it with the following code. This should show two lines, each starting with “origin” and your Github link and ending with fetch and push, respectively.

8. Finally you can push your code to your Github repository with the following code.

Full Stack Software Engineer/ Web Developer and former Mechanical Engineer https://www.linkedin.com/in/ariel-jakubowski/

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store