Chapter 3. Git & GitHub Project Setup

To initiate a project with Git and GitHub, you need to create Local and Remote Repositories that will be used to save your code and share it with others.
At this step, you'll also need to connect the Local Repository with the Remote Repository. Depending on your project situation, the project setup approach can be different.
In this chapter, we'll explain the project setup approaches in three cases:
- Case 1: As a project initiator (owner)
- Case 2: As a project member (collaborator)
- Case 3: As a non-project member (creating a new project using a copy of an existing project)
What We Cover in This Chapter
The following topics are covered in this chapter:
Three Cases in Git & GitHub Project Setup
In this section, we'll explain different scenarios for setting up a Git and GitHub project. The setup steps vary depending on your role in the project—whether you're starting from scratch, joining as a collaborator, or working with an existing project.
Git & GitHub Project Setup Overview in Different Cases
We'll cover the step-by-step setup process for each of the three cases, outlining key commands and best practices to get started efficiently.
Building Remote Collaboration Practice Environment
In this section, we'll explore how to set up a practice environment for remote collaboration. This includes configuring multiple user accounts, setting up VS Code, and managing GitHub access for testing purposes.
Project Initiator – Key Steps To Launch Git Project
As a project initiator, you need to create a Local Repository, commit your first code, set up a Remote Repository, and link both repositories. We'll walk through these steps in detail.
Project Initiator – Create Local Repository (git init)
In this section, we'll explain how to initialize a Local Repository using the git init
command and what happens in the background when you do so.
Project Initiator – Make the First Commit
Once your repository is initialized, it's important to make your first commit. We'll cover key Git commands such as git add
, git commit
, git status
, and git log
.
Project Initiator – .gitignore File
Some files should not be included in version control, such as logs and environment files. In this section, we'll discuss how to use a .gitignore
file to exclude unnecessary files from your repository.
Project Initiator – Create Remote Repository
To share your project, you need to create a Remote Repository on GitHub. We'll guide you through the process of setting it up via the GitHub web interface.
Project Initiator – Link Between Remote and Local Repositories (git remote add)
To establish a connection between your Local Repository and the Remote Repository, you need to use the git remote add
command. This section will explain how to configure this properly.
Project Initiator – Upload Local Repository to Remote Repository (git push)
After linking your repositories, you can upload your code to GitHub using the git push
command. We'll explain the syntax and common usage scenarios.
Project Initiator – Grant Remote Repository Access to Project Members
Collaboration in GitHub requires granting access to project members. In this section, we'll show how to invite contributors to your repository.
Project Member – Start Project As Collaborator
If you're invited as a collaborator, you must first accept the invitation and then clone the repository to your local computer. This section outlines the necessary steps.
Project Member – Create Copy of Project Code on Local Computer (git clone)
To start working on a shared project, collaborators use the git clone
command. We'll demonstrate how this works and explain how it links your Local Repository to the Remote Repository.
Non-Member – Start Project With Replica of Existing Repository (Fork)
If you want to start your own project based on an existing repository, you can Fork the repository on GitHub. This section will show how Forking works and its advantages.
Fork vs. Clone
Fork and Clone are often confused. We'll compare these two operations, highlighting when to use each based on different development needs.
Learn offline for better focus!
A book for this course is available on Amazon.
Git & GitHub Visual Guide
The Hands-On Manual for Complete Beginners to Master Version Control and Remote Coding Collaboration
Get the Book Now