HomeToolsAbout a20k

Common Errors

error: Your local changes to the following files would be overwritten by checkout

Error Message

error: Your local changes to the following files would be overwritten by checkout

Remedy

Discard current changes and use force checkout to another branch

git checkout -f branch_name

remote: Repository not found.

Error

remote: Repository not found. fatal: repository 'https://github.com/organization_name/repository_name.git/' not found

When creating a new repository on an organization, pushing after linking the git remote may result in remote: Repository not found error

  • (note) It is not clear whether pushing to an organization's repository may be causing this issue
  • This may have to do more with private repositories in general

Remedy

Remove the origin linked to the local repository

git remote rm origin

git clone the remote repository with personal access token value prepended to the url:

git clone https://user_personal_ssh_key@github.com/organization_name/repository_name.git

user_personal_ssh_key is identical to what user created for their own repository

  • ssh_key = user identity
    • So if a user has access to a repository, a single ssh_key should give access to all repositories

error: src refspec master does not match any.

Error

error: src refspec master does not match any.

Attempting to push to initialized remote repository results in the error message

Remedy

Run git commit and push again

fatal: This operation must be run in a work tree

Error

fatal: This operation must be run in a work tree

This happens when you run commands on a destination (remote) of the repository instead of the local

Remedy

Use git commands in git repository

© VincentVanKoh