Git & GitHub 000: Basics

Neha
GigaGuardian
Published in
2 min readDec 19, 2022
ImageSource

Here are the steps to push code to a GitHub repository:

  1. Create a GitHub account and log in.
  2. Create a new repository by clicking the “New” button in the top-right corner of the dashboard.
  3. Give your repository a name and a brief description, then click the “Create repository” button.
  4. Open a terminal or command prompt, and navigate to the local directory where you want to store your code.
  5. Initialize the local directory as a Git repository by running the following command:
git init

6. Add the files in your local repository and stage them for commit. To do this, run the following command:

git add .

7. Commit the staged files to the local repository. This creates a snapshot of the files in their current state, along with a message describing the changes. To commit the files, run the following command:

git commit -m "commit message"

8. Add the URL of the remote repository as a remote for your local repository. To do this, run the following command, replacing <remote_repo_url> with the URL of your remote repository:

git remote add origin <remote_repo_url>

9. Push the committed changes to the remote repository. To do this, run the following command:

git push origin master

This will push the code in the local repository to the remote repository on Github.

I hope you enjoyed this introduction to Git & Github!

Follow me: LinkedIn, Twitter

--

--