CREATE NEW GIT REPOSITORY
Now that you have Git installed and a GitHub account set up, let's create your first Git repository and push it to GitHub.
Creating a Local Repository
Follow these steps to create a new Git repository on your local machine:
Open GitHub Desktop: Launch GitHub Desktop on your computer.
Create New Repository: Click on the "File" menu, then select "New Repository..." from the dropdown.
Choose Repository Name and Location: In the "Name" field, enter a name for your repository. Choose the directory where you want to store your repository files on your computer.
Initialize with a README (Optional): You can choose to initialize your repository with a README file, which is a good practice to provide basic information about your project.
Click "Create Repository": Once you've entered the necessary information, click the "Create Repository" button to create your local repository.
Making Changes and Committing
Now that you have a local repository, let's make some changes to it and commit those changes:
Open the Repository in your Code Editor: Use your preferred code editor to open the directory where you created your local repository.
Make Changes: Create or modify files in your repository as needed for your project.
Stage Changes: In GitHub Desktop, you'll see the files you've modified or created listed under "Changes." Check the box next to each file you want to include in the commit to stage those changes.
Commit Changes: Enter a summary and, optionally, a description for your commit in the "Summary" and "Description" fields. Then click the "Commit to main" (or your main branch name) button to commit your changes locally.
Pushing Changes to GitHub
Once you've committed your changes locally, you'll want to push those changes to your GitHub repository:
Publish Repository: In GitHub Desktop, click on the "Repository" menu and select "Publish repository" to publish your local repository to GitHub.
Choose Repository Visibility: Choose whether you want your repository to be public or private on GitHub.
Click "Publish Repository": Once you've selected the visibility, click the "Publish Repository" button to push your changes to GitHub.
Congratulations! You've successfully created a new Git repository, made changes to it, and pushed those changes to GitHub. You can now collaborate with others by sharing the URL of your GitHub repository.
In the next section, we'll cover how to clone an existing repository from GitHub and start working on it locally.
Last updated