DEV Community

Nyambura Thuita
Nyambura Thuita

Posted on

My First GitHub Project: From a Local Folder to GitHub Using Git and SSH

Creating SSH key

  • At first I confirmed that my Github username and email were associated with Git.

The commands:
github config --global user.name
github config --global user.email

Generate SSH key

To generate the SSH key I ran:
ssh-keygen -t ed25519 -C "my email"

  • The SSH key is saved to specific file location such as drive C on the laptop.

Copy the public key

The command:
cat ~/.ssh/id_ed25519.pub

Add the SSH key to Github

Profile-Settings-Access-SSH and GPG key- New SSH key
Then:

  • Add Title, Key type(Authentication key) and Paste the entire SSH key, Click Add SSH key.

Test Connection

On Git Bash ran:
ssh -T git@github.com

  • The correct output should be that I have been successfully authenticated with my GitHub account

Pushing a Local Folder to GitHub

  • cd Desktop - navigate to desktop
  • mkdir 'Kenyan Health Records Analysis'- create this folder on desktop
  • cd Kenyan Health Records Analysis- navigate into this folder
  • touch README.md- create a README file
  • mkdir data- create this folder within the Kenyan Health Records Analysis folder
  • Copy the csv file into the data folder.
  • nano README.md - open the README file so as to edit it directly in GitBash. save and exit the file.
  • git init- initialize a Git repo.
  • git status- shows the current status of the files
  • git add .- stage all files/ changes for the next commit
  • git commit -m "First commit on health records" - commits all files created to the repo.
  • Create a new repo on Github page and copy the SSH link.
  • git remote add origin "ssh link of the new repo on the GitHub page"
  • git push -u origin main - pushes all files into the repo

GitHub Link:https://github.com/Thuita24/Kenyan-Health-Records.git

Top comments (0)