How to add an existing project to github repository

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.

Answers 1
  • 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
    
    -1

    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