Signing Up on GitHub
- Visit GitHub: Open your web browser and go to the GitHub website: https://github.com.
- 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.”
- 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.”
- 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.
- 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
- 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.
- 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 "firstname.lastname@example.org"
- 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.”
- 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:
- 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"
- 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.
- 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.