9. Oct 2020 |

My little git helper

…or create a new repository on the command line

echo “# icd0008-2020f-05” >> README.md
git init
git add README.md
git commit -m “first commit”
git branch -M main
git remote add origin https://github.com/robineero/icd0008-2020f-05.git
git push -u origin main

…or push an existing repository from the command line

git remote add origin https://github.com/robineero/icd0008-2020f-05.git
git branch -M main
git push -u origin main

“Remote origin already exists” error (viide): git remote set-url origin https://github.com/your/repository

Which git is: git remote -v

Git not working


The files/folder in your version control will not just delete themselves just because you added them to the .gitignore. They are already in the repository and you have to remove them. You can just do that with this:

(Remember to commit everything you’ve changed before you do this.)

git rm -rf --cached .
git add .

This removes all files from the repository and adds them back (this time respecting the rules in your .gitignore).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.