GitHub I: Getting Started with GitHub
In Virtual Environments II and Juypter Notebook I I we created a virtual environment for your project and set up Jupyter Notebooks. Now that you have a nice little environment set up on your local machine inside the folder for your project, it’s time to create your GitHub repository. In this tutorial, we will cover the basics of setting up your workflow with GitHub.
This blog is part of a series of tutorials called Data in Day. Follow these tutorials to create your first end-to-end data science project in just one day. This is a fun easy project that will teach you the basics of setting up your computer for a data science project and introduce you to some of the most popular tools available. It is a great way to get acquainted with the data science workflow.
I. Why Should I Use GitHub?
GitHub is a powerful tool for collaboration. Using GitHub, you can show case your work to share with others. You can also use GitHub for version control on solo and group projects.
GitHub keeps track of how often you contribute (or upload) files to your GitHub. When you are looking for a job, it will be really helpful direct your potential employer to your GitHub portfolio. Regular updates are a great way to show your future employer that you are comfortable using Git. In addition, regular uploads will demonstrate that you are enjoying what you are doing.
II. Creating a Repository on GitHub
1. Make sure that you followed the steps outlined in the first four parts of this tutorial and that you have:
- Created a project folder
- Activated the a new virtual environment in the project folder
2. Navigate to GitHub.com. Create an account if you don’t have one. Head over to the Repositories tab. Once there, click on the green button in the upper right corner that reads New.
3. Enter a unique repository name — for this project we will use something like ‘MyProject’. Key in a simple description. You can change it later if you want.
4. Set the repository to public or private. When you get to the bottom of the page DO NOT select any of the items in the “Initialize this repository with…” section.
5. Click ‘Create a Repository’.
III. Initialize Your Repository Locally
6. Open up Terminal and enter:
$ cd MyProject
17. Once you are in there, we can initialize the repo by entering the following:
$ echo “# MyProject” >> README.md
$ git init
$ git add README.md
$ git commit -m “first commit”
$ git branch -M main
$ git remote add origin https://github.com/your_username/MyProject.git
$ git push -u origin main
Now, we have a GitHub Repository for MyProject. This is how we will connect our local files to the repository that is online. Once connected, we can use commands to push (or upload) new versions of our project as we complete them. GitHub will keep track of the changes and the different versions.
IV. What Did we Do?
1. Created a free GitHub account.
2. Created a repository for our project.
3. Initialized the repository locally in the project directory.
4. Made our first commit by adding README.md
V. What’s Next?
In Python I and Pandas I, I’ll show you how to begin using Pandas to perform data analysis with Python and Pandas on the Metal Bands by Nation data set.
For more tutorials like this one, you can check out Data in a Day.