Fixing errors by practical examples

This section will help the readers a lot because the errors mentioned can occur very frequently. This will summarize the entire chapter. Sometimes, especially when you are not really familiar with Git, you don't know how to fix it. Here are the most common errors that will occur:

  • Remote origin already exists: This error occurs when you already have a remote repository specified and the remote origin removed and added:
    Erik@server:~$ git remote rm origin
    Erik@server:~$ git remote add origin https://github.com/sexyboys/InflexibleBundle.git
    
  • Git push fails with rejected error: This error occurs because you didn't execute git pull before git push:
    Erik@server:~$ git pull
    Erik@server:~$ git push
    
  • Git push fails with ...

Get Git Best Practices Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.