DEV Community

Zsolt Szakal
Zsolt Szakal

Posted on

#SimpleGuide001 - How to clone GitHub repository and push it to another repository

Hi, I am Zsolt a beginner self-taught developer. I just started my journey into coding and CS and decided create simple step by step guides to help my learning process.

Simple Guide 001

How to clone GitHub repository and push it to another repository




A simple step by step guide for beginners to clone a repository from GitHub using command line.




Step 1 - Create a dekstop folder for your project

  • Open your chosen command-line interface (I use and love Hyper)
  • Go to your desktop folder --> $ cd Desktop
  • Create new project folder --> $ mkdir folder_name

Step 2 - Create GitHub repository

  • Log in to GitHub
  • Click new
  • Type in repository name
  • Click Create repository

Step 3 - Clone a GitHub repository

  • Go to the GitHub page what you want to clone
  • Click Code
  • Copy URL
  • Go back to your command-line interface
  • Go to your project folder --> $ cd folder_name
  • Clone repository --> $ git clone copied url

Step 4 - Remove remote origin and add push to new remote origin

  • Copy new origin url from the the GitHub repository you created
  • Remove remote origin --> $ git remote remove origin
  • Add new origin --> $ git remote add origin copied url
  • Add all files --> $ git add .
  • Commit --> $ git commit -m "First Commit"
  • Push folder to GitHub --> $ git push -u origin main

When command-line finished to upload you can go back to the folder that you created on GitHub and you will see that it has been uploaded.

Top comments (0)