Mastering GitHub: A Step-by-Step Guide to Uploading Projects
Written on
Chapter 1: Getting Started with GitHub
In this guide, we will explore how to utilize GitHub for managing and storing your software projects. We will cover how to use the Git command-line interface (CLI) to push your project to GitHub.
Open a GitHub Account
Upon clicking sign-up, you will encounter a prompt asking for your email address. After entering your email, follow the subsequent steps to complete your account creation. Once your account is set up, you can initiate your first project by clicking the plus icon in the top right corner of your GitHub dashboard. From the dropdown menu, select “New repository” to create a new repository.
When you select “New repository,” a new screen will appear. Here, you must provide a name for your repository (one that hasn’t been used before).
Note: The repository name is mandatory for creation.
While the description field is optional, you may use it to elaborate on the purpose of your repository. You can also choose whether to make the repository Public or Private. A Private repository can only be accessed by you and collaborators you invite.
Adding a README file is optional and can be done later, as can the .gitignore file, which specifies files you wish to exclude from your repository. We will not delve into licensing in this tutorial.
After creating your repository, you will see a screen guiding you on how to push your project to GitHub.
The first video covers how to upload files, folders, and projects to GitHub, providing a visual guide to the process.
Creating Your Project
Now that your GitHub repository is ready, you can start adding your project. The screen that appears after repository creation offers two options: to create a project from scratch or to upload an existing project to GitHub.
If you haven’t yet created any code, you can do so quickly. Begin by creating a folder for your project and then open your terminal. Once your terminal is open, change the directory to that folder.
# Create a README.md file
echo "First line of the readme file" >> README.md
# Initialize Git in the folder
git init
# Add README file to the staging area
git add README.md
# Create your first commit
git commit -m "initial commit"
# Move to the branch you want to push your commit (typically master)
git branch -M master
# Add your remote repository URL
git remote add origin <your-repo-url>
# Push your changes
git push -u origin master
And there you have it! 🚀 Your repository has been created, and your changes have been successfully pushed to GitHub.
When you make further modifications to your code and wish to push these updates, you can do so with the following commands:
git add .
git commit -m "feat(): description of feature"
git push origin master
You can also learn about the eight most commonly used GitHub commands here.
In conclusion, this guide has provided you with the essential steps to add your project to GitHub and push your changes. I hope this inspires you to utilize GitHub more often to showcase your work and contribute to open source.
Follow me on Twitter and subscribe for more content on YouTube. Happy coding!
Melih
Chapter 2: Adding Existing Projects to GitHub
The second video demonstrates how to add an existing project to GitHub, making it easy to integrate your current work into the platform.