Skip to content

Troubleshooting

Symptom Probable Cause Solution
fatal: repository not found when running git clone The repository URL is incorrect, or the repository is private and you do not have access. Double check the URL for typos. If the repository is private, make sure the owner has granted you access.
fatal: not a git repository when running any Git command You are not inside a Git repository folder. Your terminal is in the wrong directory. Run cd repository-name to navigate into your cloned project folder, then try the command again.
error: failed to push some refs when running git push The remote repository has changes that your local copy does not have. Someone else may have pushed to main before you. Run git pull first to fetch and merge the latest changes, then run git push again.
Git asks for a username and password when pushing, and authentication fails GitHub no longer supports password authentication for Git operations. Create a Personal Access Token (PAT) in GitHub > Settings > Developer settings > Personal access tokens. Use this token as your password when prompted.
CONFLICT (content): Merge conflict in <file> after running git merge Two branches modified the same lines in the same file, and Git cannot automatically combine them. Open the conflicted file in VS Code, look for the <<<<<<<, =======, and >>>>>>> markers, choose which changes to keep, remove all markers, then run git add <file> and git commit.
Conflict markers (<<<<<<<, =======, >>>>>>>) still appear in the file after resolving Not all conflict markers were removed from the file before saving. Open the file in VS Code and search for <<<<<<< to find any remaining markers. Remove all of them, save the file, then stage and commit again.
error: Your local changes to the following files would be overwritten when switching branches You have uncommitted changes in your working directory that conflict with the branch you are trying to switch to. Either commit your changes with git add . and git commit -m "message" before switching, or run git stash to temporarily save them.
Running git push says Everything up-to-date but changes are not on GitHub You committed your changes on a different branch than the one you pushed, or you forgot to commit before pushing. Run git status to check if you have uncommitted changes. Run git branch to confirm you are on the correct branch.
code . does not open VS Code from the terminal VS Code is not added to your system PATH. Open VS Code, press Ctrl+Shift+P, type Shell Command, and select Install 'code' command in PATH. Restart your terminal and try again.
fatal: refusing to merge unrelated histories when running git push Merging two branches with no common starting point. Use git pull --allow-unrelated-histories first to allow the branches to merge then git push.