How to push a new project to github

Here's a step-by-step guide on how to push a new project to GitHub:

Prerequisites:

  1. You have a GitHub account and have created a new repository (repo) for your project.
  2. You have cloned the repository to your local machine using Git.
  3. You have created a new project folder on your local machine and initialized a Git repository in it using git init.

Step 1: Add files to your local repository

  1. Navigate to your project folder in your terminal or command prompt.
  2. Add all the files in your project folder to the Git repository using git add. (dot at the end). This will stage all the files in your project folder.
  3. Verify that all files are staged using git status.

Step 2: Commit changes

  1. Commit your changes using git commit -m "Initial commit" (replace "Initial commit" with a meaningful commit message).
  2. Verify that your commit is successful using git log.

Step 3: Link your local repository to your GitHub repository

  1. Navigate to your GitHub repository and copy the URL of your repository (it should be in the format https://github.com/your-username/your-repo-name.git).
  2. In your terminal or command prompt, navigate to your project folder and run git remote add origin <copied-url> (replace <copied-url> with the URL you copied from GitHub).
  3. Verify that the remote repository is linked using git remote -v.

Step 4: Push your changes to GitHub

  1. Push your changes to your GitHub repository using git push -u origin master (replace master with the name of your branch if it's not the default branch).
  2. You will be prompted to enter your GitHub credentials (username and password).
  3. Once the push is successful, you should see a confirmation message indicating that your changes have been pushed to GitHub.

Step 5: Verify your changes on GitHub

  1. Navigate to your GitHub repository and verify that your changes have been successfully pushed.
  2. You should see your files and commit history reflected in your repository.

That's it! You have successfully pushed your new project to GitHub.