A Tiny Intro to GitHub

The following is part of a series of tiny intros I usually write about on another blog, but since this might interest even non-techies and it’s meant to be basic and easy to start with, here it is !

Dan Crisan
4 min readDec 20, 2015

Sooner or later, you’ll want to use it: you might want to store your projects somewhere, expose their source code or simply work on other’s people projects. Long story short, GitHub is like a GoogleDrive for code. It is a hosting service.

What’s the difference with Git?

Git is a tool that allows version control: it allows you to manage your source code history. GitHub allows you to store the source code of your projects (and their history), collaborate, but also expose your work (as a portfolio). You can create repositories on GitHub (repos behave like folders) and push your code to your repos by using Git.

So let’s get started. Within the next lines, we’ll create a GitHub account and push our first lines into a repo. The same approach can be used for any other project that you have and that you want to store on GitHub.

1) Create a GiHub account at : https://github.com/join

2) Choose a plan and create account (you can start with the free one)

3) Verify your email address if required

You are almost done. Time to create the new repository.

4) Create the new repository : pick a name, the public repo and check “Initialize this repository with a README”

5) You now have a repo. It’s like a folder, but remotely, on a server. That’s where the code of your project will “live”. Notice there is a link on the repo’s page.

Well done, you just created a repository on GitHub. However, it’s a little boring that it only contains a readme file. Let’s add some content. Here is where Git comes in.

6) Download git from https://git-scm.com/

7) Concerning Git, I’ll cover the basics related to GitHub in the next lines, but I strongly suggest you to also follow this quick and super easy tutorial : https://try.github.io/levels/1/challenges/1

8) In your command line, create a folder on your desktop called “My-first-github-project”

9) Get to your newly created folder

10) git init (we’ve seen this in the tutorial at step 8: this initializes your folder: it is now ready to be connected to a repository. You only need to do this once.)

11) git pull linkFromGithubHere (instead of linkFromGithub, you’ll copy paste the link we highlighted at step 5, the link from your repo). This command extracts the content of the online repository and pulls it into your local folder, on your machine.

You now have a local copy on your PC. Now what? Let’s modify our new project.

12) We want to change our readme file. From your local folder, open it in any text editor you want and add another line (anything, say “HO HO HO”).

13) git status (this shows you which files have changed. In other words, what are the files that you just edited on your local machine? Notice that nothing changed on your online repository (refresh the web page). The only files that are changing are on your local machine).

14) git add . (adds all the files that you changed. Notice the dot, it’s important)

15) git commit -m ‘put any message here that’s describing the changes you want to push’

16) git push linkFromGithubHere (pushes all the changes to your github repo. Your work is now saved on GitHub’s servers. You can pull, add, commit, push from any other PC with your credentials )

17) If you get any suggestions on step 17, feel free to follow those suggestions . Usually it’s the set-upstream . If it happens, just type it : it will push your changes to the current repo.

Done! Refresh the repository web page to notice that your code is now on GitHub =]

Thank you for reading.

@dandancrisan

PS : If you are a student, you might want to request a discount + some other freebies from GitHub. Check this out https://education.github.com/ =]

--

--