Setting Up Git and GitHub: Your First Repository

Git Command Line Creating First Repository
Git Command Line Creating First Repository

Live stream set for 2025-07-18 at 14:00:00 Eastern

Ask questions in the live chat about any programming or lifestyle topic.

This livestream will be on YouTube or you can watch below.

Introduction to Git and GitHub

Git and GitHub are essential tools for developers, offering version control and collaboration features that make managing your projects easier. Whether you’re working solo or as part of a team, Git helps you track changes in your code, while GitHub allows you to host your code online and collaborate with others. In this post, we’ll walk through the process of setting up Git and creating your first repository on GitHub. Plus, we’ll dive into how open-source projects can benefit from these tools.

What Is Open Source?

Open-source software means the source code is available for anyone to view, modify, and distribute. This fosters a collaborative environment where developers from all over the world contribute to projects, making them more robust and innovative.

Step 1: Installing Git on Your Local Machine

Before you start using Git and GitHub, you need to install Git on your computer.

For Windows:

  1. Download Git from the official website.
  2. Run the installer and follow the installation steps (the default options are usually fine).
  3. Once installed, open Git Bash (you should see it in your Start menu).
  4. Verify the installation by typing:
  5. git --version
  6. You should see a message displaying the installed version of Git.

For macOS:

  1. Open Terminal.
  2. Type:
  3. git --version
  4. If Git is not already installed, you’ll be prompted to install it via the Xcode command line tools.

For Linux:

Use the package manager for your distribution to install Git. For example, on Ubuntu:

sudo apt-get update
sudo apt-get install git

Step 2: Setting Up Your GitHub Account

  1. Go to GitHub and sign up for an account if you don’t already have one.
  2. Once signed up, you can create repositories and start collaborating with other developers.

Step 3: Configuring Git with Your GitHub Account

Once you’ve installed Git and set up your GitHub account, you need to configure Git with your name and email (the email should match the one associated with your GitHub account).

Configure your name and email in Git:

Open your terminal or Git Bash and run the following commands:

git config --global user.name "Your Name"
git config --global user.email "your-email@example.com"

This ensures that your commits are associated with the correct name and email on GitHub.

Step 4: Creating Your First Repository on GitHub

  1. Log into GitHub and click the + button in the top right corner of the screen.
  2. Choose New repository from the dropdown menu.
  3. Give your repository a name (e.g., my-first-repo).
  4. Optionally, add a description for your project.
  5. Choose Public to make your repository open source (anyone can view and contribute).
  6. Click Create repository.

[Screenshot Placeholder]
(Include a screenshot of the GitHub repository creation screen)

Step 5: Cloning Your GitHub Repository to Your Local Machine

Now that your repository is created, let’s clone it to your local machine so you can start working with it.

  1. On your GitHub repository page, click the Clone or download button.
  2. Copy the HTTPS URL provided.

Now, open your terminal or Git Bash and run the following command:

git clone https://github.com/yourusername/my-first-repo.git

This command creates a local copy of your repository on your computer.

[Screenshot Placeholder]
(Include a screenshot of the terminal running the git clone command)

Step 6: Making Changes and Pushing to GitHub

Now that your repository is cloned locally, you can start working on it. Let’s add a new file and push the changes back to GitHub.

  1. Navigate to the folder where you cloned the repository. You can do this via the command line:
    cd my-first-repo
  2. Create a new file (for example, index.html or README.md).
  3. Add the file to Git’s staging area by typing:
    git add index.html
  4. Commit your changes:
    git commit -m "Added index.html file"
  5. Push your changes back to GitHub:
    git push origin main
Git Check And Clone
Command Line Git Check And Cloning Of Repository

Git Add And Commit
Terminal Showing Git Adding to Staging Area And Committing Changes

Step 7: Viewing Your Changes on GitHub

After pushing your changes, head back to your GitHub repository page. You should see the newly added file(s) there.

Conclusion

Congratulations! You’ve now set up Git and GitHub, created your first repository, and pushed your first commit. Git and GitHub are powerful tools that can help you manage your code and collaborate with others, especially for open-source projects.

If you want to dive deeper into Git and GitHub, be sure to check out my programming books and online courses for more in-depth tutorials:

For personalized guidance, I’m also available for one-on-one programming tutorials. Feel free to reach out to me here.

Check out this live screencast for a hands-on walkthrough of these steps:

Screencast Of Git Repository Setup

This is just a simple start to working with Git and GitHub. As you continue, you’ll explore more advanced features like branching, pull requests, and working with other developers on open-source projects.

Call to Action:

Are you ready to dive deeper into version control and open-source? Check out my online programming courses to get started today!

About Edward

Edward is a software engineer, web developer, and author dedicated to helping people achieve their personal and professional goals through actionable advice and real-world tools.

As the author of impactful books including Learning JavaScript, Learning Python, Learning PHP, Mastering Blender Python API, and fiction The Algorithmic Serpent, Edward writes with a focus on personal growth, entrepreneurship, and practical success strategies. His work is designed to guide, motivate, and empower.

In addition to writing, Edward offers professional "full-stack development," "database design," "1-on-1 tutoring," "consulting sessions,", tailored to help you take the next step. Whether you are launching a business, developing a brand, or leveling up your mindset, Edward will be there to support you.

Edward also offers online courses designed to deepen your learning and accelerate your progress. Explore the programming on languages like JavaScript, Python and PHP to find the perfect fit for your journey.

📚 Explore His Books – Visit the Book Shop to grab your copies today.
💼 Need Support? – Learn more about Services and the ways to benefit from his expertise.
🎓 Ready to Learn? – Check out his Online Courses to turn your ideas into results.

Leave a Reply

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