2. Project management

This week I worked on learning how to update this website on gitlab.fabcloud.org and worked through a git tutorial. My Git Tutorial experience is documented below.

Introduction

My name is Gyasi Williams. This is my first time in Fab Academy. I’ve been wanting to take this course for years, so I am excited about the opportunity. I have a Bachelors degree in History from the University of California at Berkeley, though I began my time there as a double major in Electrical Engineering and Computer Science. I have a passion for music, particularly jazz, and have played professionally as a saxophonist. I love sports, especially basketball and football. I grew up in Southern California and have lived much of my adult life in New York City.

Git Tutorial

“The Recitation for Project Management hinted at the fact that the Atom text editor might be helpful when working with git. So, I downloaded Atom and saw that some git functionality (working directly with Git and GitHub) is built into the application. An added bonus is that the “flight manual” for Atom has a git tutorial that can easily be used with its GitHub Package, so I decided to use that.

After quickly realizing that this tutorial didn’t use the command Terminal, I realized I had to find a different git tutorial. First search: TutorialsPoint Git tutorial - challenge: set up instructions were only for Linux, and I work on a Mac.

After another internet search for a git tutorial I found the following: “Git and Github Beginner Tutorial 2”, by Raghav Pal at the YouTube channel “Automation Step by Step”.

Raghav’s video then pointed me to a shortcut, of sorts, to downloading git on a Mac: Git Mac Installion. This was as simple as prompting the Terminal on my Mac to check for the version of git ($ git –version) I have, if installed on my computer. The added benefit of doing a version check in Terminal on Mac is that, if Git is not already installed, the check prompts my Mac to automatically download Git through the XCode Command Line Tools for MacOS Mojave.

That version check worked and git and xcode were installed on my computer: Git version check

In order that all the work that I do in git is identified with me, git provides for a global configuration with my name and email:

I created a file folder on my laptop to hold my git repository, “GitTutorial”. I used the git command “change directory” [$ cd ] to point git at that folder:

Once git was pointed at the local folder, I could then initiate that folder as a git repository:

My local folder, “GitTutorial” has now been converted to a git repo. But, where is the proof?

My git tutor aided in that effort with this line of code:

…and that enable me to see this:

Empowered with the knowledge that my git init worked to make my local folder a git repo, I then performed my first test to confirm that with the “git status” command:

“Git Status” informed me there were no files to commit, but more importantly informed me that my git repo is, in fact, functional: “On branch master”. Additionally, the output to git status provided me with suggested commands to add files to my git repo: “create/copy files and use ‘git add’ to track”.

So I, along with my tutorial, added a file to my local repo with the git command “touch”: The text document is blank, but still allows me to continue learning git commands (as we will see):

I ran the “git status” command again, this time with something to begin “tracking” in my local git repo:

“Git status” informed that the “test1.txt” file is “untracked”, but can begin to be tracked by git with the “git add” command. We then check if the added file is “staged” and ready to commit (notice the test1.txt file has changed from red to green, indicating it is staged for a commit):

With our file properly staged, we can commit it to the local repo: *All commits should have a message [.. -m “commit text”] giving a brief explanation of what was changed with that commit.

Having completed our first commit, we moved on to adding a different type of file:

Then we verify that the “index.html” file was added to the repo:

We then make a change to the test1.txt file by opening it and adding text:

With a newly modified “test1” file, and an added “index” file, we can practice updating the local repo. First, we check the status of the files:

I used a variation of the “git add” command “git add .”, which will add all file types (in this case, a .txt file and a .html file; “git add .” will perform the same function), followed by the “git status” command to check the staging:

With our files staged (green text indicating staged, and ready to commit), we commit them to the local git repo:

Success! Now for the test of “pushing” my local repo (“GitTutorial” folder) to a remote repository on GitHub. Step 1: create a new repo on GitHub:

Step 2: name the GitHub repo and create it (the error message shows because I had created the folder before I took a screenshot).

Step 3: copy the url for the remote (GitHub) repo:

Step 4: use it as a path to “push” a copy of the local repo to the remote repo:

Step 5: push the “master” branch to the remote repo, using “git push -u origin master”: *…and here is where I ran into trouble (“fatal: Authentication failed…”): I was able to enter my GitHub username when prompted. However, I didn’t remember my password. More importantly, I couldn’t see any evidence that the password I was typing was registering. So, I changed my password, and, after several frustrating attempts at entering my password, a Google search informed me that I wouldn’t see my password (see:“Understanding Why Terminal Doesn’t Let You Type a Password”) while typing.

After reading that article, I was able to successfully push my local repo to GitHub:

Proof: you can see the files from my local repo in my GitHub repo:

With that, I had successfully pushed a local repo to a remote repo on GitHub. The only thing to do at that point was to verify versioning history with “git log”: .

Notes

I had previous, though limited, experience using git. Therefore, my experience this time around was much more satisfying (and successful, lol). However, I did spend a considerable amount of time resizing and importing the image files I used to document my work. The standard file format for screenshots in MacOS is .png. I initially tried to resize the screenshots as PNG files, but the results were blurry, at best. I tried automating my image conversion to JPEG and resizing, and nearly succeeded (there was an error when trying to automate adding the converted and resized images to a Photos library). I ultimately succeeded in spending unnecessary time in learning a bit about MacOS’ Automator app. I ended up converting all my numerous screenshots to JPEGs manually, then manually resizing them all, before adding them one by one to the images folder for this website. All in all, this was a satisfying learning experience, as I was able to successfully push a local repo to a remote repo.