How to add an existing project to github repository

Updated at 07-Feb-2022, By samar

How to add an existing project to github repository

Hello everyone, in this post we will look at how to solve "How to add an existing project to github repository" in programming.

We provide step by step instructions to add an existing project to the github repository. You just have to create a repository in the github account and use commands to add the project to the github repository.
  • Adding an existing project to GitHub

    //1. Login to the github account and create a repository using the following URL https://github.com/new
    I have logged in to my github account and created a repository with name myapp
    //2.In the command line, navigate to the root directory of your project.
    E:\laragon\www\my-app>
      
    //3. Step by step use the below command.
    >git init
    >git config --global user.email "[email protected]"
    >git config --global user.name "YOURUSERNAME"
    >git remote add origin https://github.com/samarjeetsamar/myapp.git
    >git add .
    >git commit -m "first push"
    >git push -u -f origin master
    

    Additional info

    1. Please provide username and password asked by CLI after using git push -u -f origin master command.

    2. Provide access token instead of password while asking password in CLI.

Back to code snippet queries related git