Introduction
Git is local software that i installed on my machine to help me manage codes while github is an online platform that host git repositories.
This is a step by step guide of how i used git to publish my first project to github while a SSH key for a secure connection with github.
Tools Used
This task was done in the following environments
Windows Operating system
Git
git --version
git version 2.55.0.windows.4
- Github account
Actions Taken to Link Git and Github
This are the step by step methods that i used to mlink git and github
1) Configuring Git
Configured Git with my github username and the email I used in setting up my github account
git config --global user.name "alfieotuko"
git config --global user.email "alfiemauwa7@gmail.com"
2) Generating the SSH key
The next action is to generate ssh key. The command will generaye two ssh keys, a private ssh key which should not be share and a public ssh key which is what will be used to link the git and github. The generated public ssh key will be copied to be then pasted on github.
ssh-keygen -t ed25519 -C "alfiemauwa7@gmail.com"
clip < "c/user/omolo/".ssh/id_ed25519.pub
3) Inserting the SSH to Github
The copied ssh key will be be added to github by going to the github settings under the SSH AND GPG keys and then clicking on the ssh key. To confirm if the added ssh key was successful;
ssh -T git@github.com
After which it will display a message that it was successful.
4) Creating Local Folder
Creating a folder in the local directory that will hold data of the project.
cd Desktop
mkdir kenya-hospital-records-analysis
cd kenya-hospital-record-analysis
5) Creating a File and a Folder
Creating a README.md file inside the kenya-hospital-record-analysis folder alongside the file also creating a folder named "data".
touch README.md
mkdir data
6) Creating a Git Repository
This is to initialize and turn the folder in a git repository and to check in which branch is the folder in
git init
git status
On branch main
7) Stage and Commit
This is to stage and saving the project checkpoint history but still not saved in online cloud
git add .
git status
On branch main
git commit -m "first commit for kenya-hospital-records-analysis"
8) Linking To Github
Creating a new and empty repository on github and copying the the URL of the ssh from github and pasting it on git there by saving it on the online platform.
git remote add origin git@github.com:alfieotuko/kenya-hospital-records-analysis
9) Pushing to Github
To save the repository to github
git push -u origin main
Adding URL Link
Here is the link to my github
alfieotukoGithub
Conclusion
The local folder was saved and hosted in a cloud based github repositories with the ssh providing a secure hosting.
Top comments (0)