My First GitHub Project: From a Local Folder to GitHub Using Git and SSH
My First GitHub Project: From a Local Folder to GitHub Using Git and SSH Introduction This week I learned how to use Git, Git Bash, GitHub and setting up SSH Keys . Before this, I knew about GitHub but I did not really understand how a project moves from a folder on my computer to GitHub. A simple way I now understand the relationship is: Git manages the history of my project while GitHub provides an online home for the project. In this article, I will explain the steps I followed to create a simple project locally and push it to GitHub. Creating My Project I started by creating a folder for my project using Git Bash. mkdir Kenya-Hospital-Records-Analysis cd Kenya-Hospital-Records-Analysis Inside the folder, I created a README.md file and a folder called data . My project looked like this: Kenya-Hospital-Records-Analysis/ ├── README.md └── data/ The README.md file is where I can explain what my project is about while the data folder can be used to store datasets. In the data folder i uploaded an excel file called Kenyan_Hospital_Health_Records How to use Git The next step was to make Git start tracking my project. I did this using: git init I then used: git status This helped me see which files Git was tracking and which files had not yet been added. To add my files, I used: git add . I then saved the changes to Git using a commit: git commit -m "Initial commit" One thing I learned is that a commit is like saving a checkpoint of my project. The commit message helps explain what changes I made. Connecting Git to GitHub while generating SSH Keys To push my local project to GitHub, I needed a secure way for my computer to communicate with my GitHub account. I used SSH (Secure Shell). I first generated an SSH key on my computer and then added the public key to my GitHub account. An SSH key normally consists of two parts: Private key – stays securely on my computer. Public key – can be added to GitHub. One important lesson was that the private key should never be shared.