DEV Community

Cover image for # MY FIRST GITHUB PROJECT: FROM A LOCAL FOLDER TO GITHUB USING GIT AND SSH.
Philip Saidi
Philip Saidi

Posted on

# MY FIRST GITHUB PROJECT: FROM A LOCAL FOLDER TO GITHUB USING GIT AND SSH.

What is git and github

Git is a command line tool used to create project folders and files that can be linked to your github account repositories.
Github is a website where you put all your projects folders and files to enable collaboration with you team or anyone who can contribute to that project.
Repository is a project folder that contains all of your project files.

Creating A Folder And Files

We first create a folder in your desktop using gitbash.
I followed these steps.

_

  • open gitbash
  • First know the current directory, if you in the Root directory tab change directory to Desktop.
  • Make directory with the name of the Folder.
  • Change the directory to the current Folder created.
  • Make a file in the folder you created, like app.py or README.md.
  • Write into the README.md and save.
  • Display the contents of the file.
  • Return to the previuos folder y_ou created. Use the code below for reference
pwd
cd Desktop
mkdir Folder name like Kenya-Health-Records
cd Kenya-Health-Records
touch File name with an extension like app.py or README.md
echo "# DATA CLEANING USING EXCEL" >README.md
cat README.md 
cd . .
Enter fullscreen mode Exit fullscreen mode

Pushing Repo To Github Using Gitbash

While still in gitbash current folder I created.
I did this commands on the CLI

Run git init to initialize a git repo
Run git status to check I repo is ready 
Run git add . 
Run git commit -m "write your commit message"
Run git log --oneline to check the commit message in a oneline
Run git branch to confirm if you are in the main branch
Run git branch -M main to change master to main branch
Enter fullscreen mode Exit fullscreen mode

Open github account, login and follow these steps.

_

  • Create a repository and give it a name and description.
  • Go to your quick set ip and click SSH.
  • Copy the url command
  • Open gitbash and make sure you are in the current folder you want to push to github._ Follow this commands below
Run git remote add origin "paste the url command from github"
Run git remote -v
Run git push - u origin main 
You will be prompted for your paraphrase you created while setting git
You will see a successful message that your folder successful pushed to github
Enter fullscreen mode Exit fullscreen mode

Now go to your github account and refresh.You will see the files and folder you created in the repository you created on github.
Give yourself a clap

Top comments (0)