Adding an existing project to GitHub using the command line

Steps to create a repository in GITHUB :

  • Signup with GitHub account by giving all valid information.
  • Create a new GIT repository . To avoid errors, do not initialize the new repository with README, license, or gitignore files. You can add these files after your project has been pushed to GitHub.
  • After Installing GIT, open GIT Bash command line.
  • In command line, Change the current working directory to your local project.

           cd  “C:\myproject”

  • Initialize the GIT in your local project path by entering below command

           git init

  • Add the files to the local repository.

            git add .

  • Commit the files you are added to local repository

            git commit –m “first commit for my project”

  • At the top of your GitHub repository's Quick Setup page, click to copy the remote repository URL.

  • In the Command prompt, add the URL for the remote repository where your local repository will be pushed.

             git remote add origin remote repository URL
ex: git remote add origin  

  • Now you push the changes in your local repository to GitHub.

             git push origin master

No comments:

Post a Comment