DSC Ashesi Workshop 2: GitHub & GitBash
DSC Ashesi University hosted a workshop on Github on the 6th of October. Students learnt Version Control using GitHub and GitBash, in preparation for project collaborations. The session lasted for 3 hours. Students were enthusiastic about what was covered evidenced by the rigour of questions they asked throughout the session. About 40 students attended the session.
The following lessons were learnt,
Step 1: Creating a Folder/Directory
First, go into the folder/directory you would want to add the directory:
open GitBash and type in the following:
cd name_of_the_folderCreate the folder/directory:
mkdir name_of_the_new_directoryYou can copy and paste any file or document as a test example into this newly created directory.
Step 2: Initializing a Git repository on your PC/Laptop: This allows you to set up an environment for ‘git’ commands
git initStep 3: View Changes then Add & Commit
You can view/track the changes you would be making using:
git statusAdd the changes you have made to later commit. The ‘.’ (dot) after the add means ‘all’. If you want to ‘git add’ a specific file, specify the file name in place of the dot:
git add . ORgit add 'file_name'
Commit your changes: In place of the commit message, you input the message of your choice for example, “I have edited this file by adding a username”
git commit -m "Commit message"Step 4: Pushing Changes
Git push: If a repository exists on your GitHub whose name is the same as the one on your PC/Laptop, you initiate the Git Push Command to submit changes. Provide your GitHub username and password if prompted to do so.
Get DSC Ashesi University’s stories in your inbox
Join Medium for free to get updates from this writer.
First, connect your local repository (on your laptop) with the remote repository (on GitHub) using:
git remote add origin (link of the newly created repository from GitHub)Then, push changes:
git push -u origin masterProject Collaboration: Cloning a Repository
Cloning a repository means “copying” the content of an existing repository from GitHub and “pasting” it on your PC/laptop. This is often done when a group needs to collaborate on an existing project by working on different parts of the project.
In your gitbash,
First, change the current working directory to the location where you want the cloned directory to be made,
git clone (then paste here the URL for the repository you want to clone)Press ‘Enter’ & the clone would have been created on your laptop.
You can now work on the project you have just cloned and make the necessary addition, edits, deletions or updates. Upon completion, repeat Step 3: View Changes then Add and Commit
git add .ORgit add 'file_name'
Commit your changes:
git commit -m "Describe the commit in a few words eg, First Commit"Push to GitHub:
git push -u origin masterExtras: Navigating through your folders/directory
Go back one directory file using,
cd ..Resources
For more information on GitHub, watch the video below on GitHub Crash Course for Beginners










