Step-By-Step Guide on how to sign up on GitHub and push your code from your local Environment

.

Signing Up on GitHub

  1. Visit GitHub: Open your web browser and go to the GitHub website: https://github.com.
  2. Create an Account: Click on the “Sign up” button on the GitHub homepage. You will be prompted to enter your username, email address, and a password. Fill in this information and click “Create account.”
  3. Choose a Plan: GitHub offers both free and paid plans. For most users, the free plan is sufficient. Select the plan that suits your needs, and click “Continue.”
  4. Verify Your Email: GitHub will send a verification email to the address you provided. Check your email and click the verification link to confirm your account.
  5. Complete Your Profile: You will be prompted to provide some additional information about yourself and your interests. You can skip this step if you prefer.

Congratulations! You now have a GitHub account. Next, let’s push your code.

Pushing Code to GitHub

  1. Install Git: If you haven’t already, you need to install Git on your local machine. Download and install Git from the official website: https://git-scm.com/downloads. Follow the installation instructions for your operating system.
  2. Configure Git: Open your terminal (or command prompt on Windows) and configure Git with your GitHub username and email address using these commands:
   git config --global user.name "Your Name"
   git config --global user.email "youremail@example.com"
  1. Create a New Repository on GitHub:
  • On the GitHub website, click the “+” icon in the top right corner and select “New repository.”
  • Give your repository a name, choose visibility (public or private), and add an optional description.
  • Click “Create repository.”
  1. Initialize a Git Repository Locally: Open your local development environment (e.g., VS Code), navigate to your project folder, and open a terminal.
  • Initialize a new Git repository in your project folder: git init
  1. Add Your Files: Use the following commands to stage and commit your files to your local Git repository:
   git add .
   git commit -m "Initial commit"
  1. Connect Local Repository to GitHub: On the GitHub repository page, you’ll see a set of commands to link your local repository to the remote one. It will look something like this:
   git remote add origin https://github.com/yourusername/your-repo.git
   git branch -M main
   git push -u origin main

Copy and paste these commands into your terminal. Replace the URL with your repository’s URL.

  1. Push Your Code to GitHub: To push your code to GitHub, run:
   git push -u origin main

You will be prompted to enter your GitHub username and password. After that, your code will be uploaded to your GitHub repository.

Your code is now on GitHub! You can visit your GitHub repository in your web browser to see your files and commits. You can continue to push updates and changes to your repository by using the git push command.

Leave a Reply

Your email address will not be published. Required fields are marked *