Saturday, September 26, 2020

GitHub Frequently Used Tips and Tricks

Adding an Existing project to GitHub

  1. Create a new repository(repo) on GitHub.
  2. In command prompt open Git Bash
  3. Change the current working directory to your local project.
  4. Initialize the local directory as a Git repository.
    git init
  5. Add (stage) the files in your new local repository.
    git add .
  6. Commit staged files locally.
    git commit -m "initial commit"
  7. In GitHub copy the https url of your newly created repo (e.g https://github.com/xxxxxxx.git)
  8. In the command prompt, add the URL for the remote repository where your local repository will be pushed.
    git remote add origin
    https://github.com/xxxxxxx.git

    git remote -v
  9. Push the changes in your local repository to GitHub.
    git push -f origin master