A guide to getting started with Git and Github

Step 1: Create a repository in Github

Create a Github account and then create a repository by following the demonstration below. If you want to include the README file, Click “Initialize this repository with a README”. It’s super easy, just make yourself comfortable a bit

Step 2: Configure git

Open a Command Prompt or the GIT Bash terminal preferably and run the commands to configure your Git username and email by replacing “my_username” and “my_email@example.com” with your own.

git config --global user.name "my_username"
git config --global user.email "my_email@example.com"

Step 3: Clone GitHub repository

On GitHub, navigate to the main page of the repository. Under the repository name, click Code and simply open the Git bash window on windows or the Terminal windows for mac and Linux. Then type the following command and press Enter

git clone "paste the URL you just copied"

Step 4: Make changes and add to git

Now, get into the repository and you possibly have some files to put into your repository, or maybe you want to edit some file. You can do whatever you want. Let’s add a “hello.py” file to our GitHub repository, some code and check the status by running

git status
git add <filename_one>
git add --all

Step 5: Commit changes with a message

A git commit can reference bugs or issues that will be fixed with the change. It can also include links to more information when relevant. It’s frustrating to go back to repositories history and discover that there’s not enough context to understand what was changed and why. It takes only a few more seconds to write a better description.

git commit -m "<add your commit message here>"
git push
git push origin master

Congratulations! 🎉 🎉 🎉

You made it 😊

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store