Introduction
In my 2nd Week in Data Science & AI Analytics at LUX Academy we dive more into Git Bash and GitHub interactions and operations by doing our first project and publishing it on GitHub using push , commit and remote origin commands.
Steps from start to publishing on GitHub
-
Gathering Information
The data for this project was provided as Excel forms both
.xlsxand.csvfiles, by the instructor. -
Creation of local folders
I created my local folder in my laptop's Desktop folder using git bash commands. In Git Bash, using the
cdcommand I navigated to my Desktop which was located inside OneDrive folder. cd ~/OneDrive/Desktop/
Inside the Desktop folder, I created a new folder and named it after my project Kenya-Hospital-Health-Records-Analysis using themkdircommand.
I then usedcd Kenya-Hospital-Health-Records-Analysisto move into the new folder(directory). Inside this folder, I created a new subfolder called data usingcd data, to hold my files. I then created the README file which holds information about my project and is a crucial part of any GitHub repository. Here I used thetouchcommand i.etouch README.md. -
Moving files from Downloads to my project data folder
Since the data I was provided with was shared via WhatsApp, I downloaded the files into my laptop's Downloads folder and I had to move them to my project folder(data).
Using git bash commands I easily moved my file from Downloads to data folder. Command for moving files in git ismv /sourceFolder/filename.file_extension /destinationFolder. In my case all i did to do was
mv ~/Downloads/Kenyan_Hospital_Health_Records.xlsx ~/OneDrive/Desktop/Kenya-Hospital-Health-Records-Analysis/data
Now that my folder and data were set, I was ready to push and publish on GitHub.
-
Creation of GitHub Repository
In order to push from my local folder to GitHub, I needed to create a repository on my GitHub account. I logged into my GitHub account, navigated to Repositories(appears once you click the profile icon at top right corner) and then clicked NEW. I then type my repository name Kenya Hospital Health Records Analysis, entered a short description about it, and then clicked Create repository. Once my repository was ready I copied the SSH address.
-
Connecting Local folder and GitHub repository
- First I used
ssh -T git@github.comto test my connection which was successful. - Using
git initI created the hidden .git folder that lets git to track the files in my working directory(folder). - Using
git branch -M mainI ensured that my local branch was named main to align with GitHub defaults. - using
git add .andgit commit -m "adding my kenya health records analysis project"I added my files to the staging area and created my baseline snapshot. - I then linked my local repository with GitHub repository via SSH using
git remote add <SSH_address copied from GitHub earlier>
- First I used
-
Pushing my project to GitHub
Using
git push -u origin mainI uploaded my commits and set the default upstream tracking branch. -
Verifying Successful Push
I then returned to my GitHub account, and after refreshing the page, my project had successfully been uploaded to my GitHub repository and the content of my README.md was on display.
_ I am so happy that after a few challenges with git bash commands I successfully managed to complete my first project. I am ready for the next challenge as we dive deep into Data Science_
Top comments (0)