GitHub vs. Life
“So who are you Natalia? Your last name is so long…where are you from? How did you get into coding? You last post on CSS was pretty rad, what else have you been learning at The Iron Yard academy? Can I see pictures of your cats?”
Whoa whoa, slow down. Of course you can see pictures of my cats.
And now, I shall answer your questions.
I came from to Houston, TX from Moscow, Russia in 2002, when I was 11 years old. Until college I dreamt of being the next Katie Couric/Diane Sawyer, or perhaps owning the BBC. After getting as fluent in English as I am in Russian, I dove into various media production and public speaking activities, such as Cross-Examination debate, the award-winning Carillon yearbook, a Houston Chronicle workshop, and countless others.
However, by the time I began my B.A at the University of Houston my romance with journalism faded, and I focused my studies on Corporate and Organizational Communication (which is absolutely fascinating), minoring in Mandarin Chinese for the challenge and extra marketability. Starry-eyed and enthusiastic I entered the work-force, just as the Houston oil market loudly crashed. Internship, after internship, after part-time job, I hustled, networked, and volunteered, but nothing stuck long-term.
It was time to find a career that was challenging, rewarding, and also flexible. Knowing how to operate successfully in an international business setting is great, but it was time to admit that I needed a concrete technical skill. Enter: Front End Engineering.
I decided to go into Front End because I enjoy linguistics, and I always felt that the logic of HTML was pretty elegant. The ultimate draw, however, is the ability to obtain imaged feedback, and the gratification from seeing your design flourish visually before your eyes.
The ultimate drawback, as it turned out, was watching all your countless hours worth of work get erased during a routine GitHub upload…
(Want more info on what GitHub is and why developers are so into it? Check out this article)
Lesson 1: DO NOT name your files index2.html and styles2.css, work on them, then try to upload to GitHub, fail, rename them, notice that your layout went to hell, scramble to recover lost work, try to go back, try to erase the local repository, see that you erased everything, then look at the clock, read “4am” and cry.
Lesson 2: Programming in general, and GitHub specifically are fairly artful metaphors for life. Just because you put in hours of work, doesn’t mean your thing is going to work. Just because your thing works, doesn’t mean you understand why. Just because you took a course on how to do the thing, doesn’t mean you can keep up with it on your own when you’re out in the world. Just because everything seems terrible, doesn’t mean that there isn’t a tremendous community of people out there, willing to spend their time helping you sort everything out. Thank God for my classmates, instructors, and the GitHub developers! Oh, and Google (naturally…)
So, let’s get started with GitHub . You need to register, first and foremost. Then, you should retrieve and connect you computer’s unique SSH key in order to begin uploading your folders and files. Here is how you can do that:
Retrieving & Connecting Your SSH Key
Phase I. In Your terminal:
- cd ~/ (to go to your home directory)
- ls -a (to view all hidden files; you are looking for .ssh)
- cd .ssh
- plcopy < id_rsa.pub (copy your public ssh key to clipboard; the other one, id_rsa should be for thine eyes only!)
Phase II. In GitHub:
- Sign in => Profile => Settings => SSH Keys => New SSH Key
- Paste your copied key
- Name it something easily recognizable (ex: public key natalia’s macbook feb 2016)
- You’re ready to go!
Creating a New Repository
Pro Tip: keep a sticky note in the corner of your screen with the following steps on creating and managing your git repository (repo, for short).
In Your Terminal:
- Use the cd command to get to the folder in which your documents are located (if you don’t you may accidentally upload your entire root folder).
- git init
- hub create <type the name of your repo with no spaces; ex: “project-1”> (this will create a local repo on your computer)
- git add . (this will add all your files to the local repo)
- git commit -m <reason for commit; ex: “initial upload”> (this will prepare your files to be uploaded)
- git push origin master (this will upload your files to the remote repo)
Creating a Live Web Link
Once you’ve pushed all your files to your remote repo, you may want to create a live link to host your project and share with others. For that you’ll need to create gh-pages, a key term git recognizes and uses for live hosting.
In Your Terminal:
- In the same folder where you’ve created your local repo and have all your related files, type git checkout -b gh-pages (this will create a new branch called gh-pages and immediately switch to it).
- git push origin gh-pages
- git checkout master (do not forget to switch back to your master branch! If you keep working on gh-branches and it gets ahead of your master, uploading your stuff is going to quickly turn into a nightmare.)
Pushing Updated Work
I said it already and I’ll say it again: always work in your master branch! Once you’re ready to upload your changes, go to your terminal.
In Your Terminal:
- git branch (will show which branch you’re working in; git checkout master if you aren’t in your master branch)
- git commit -m “fixed a thing and added a thing”
- git push origin master
- git checkout gh-pages
- git merge master (also called fast-forwarding)
- git checkout master (make switching back to master a habit)
- git push origin --all
That’s it! if you’re having any problems, I recommend finding an experienced person, because git get complicated pretty quickly. Good luck! :)