Git - remote: Repository not found
Mia Lopez
I have SourceTree with local working copy. And all operations work good, I can simple fetch, push, pull and etc via SourceTree. I just needed to make force push which does not exist in SourceTree.
I opened terminal made git push -f
remote: Repository not found.
fatal: repository ' not foundI am not sure what can be an issue.
1052 Answers
12 NextRemove all the github.com credential details from the system.
For mac
Delete the github.com password from the Keychain Access.
For windows
Delete the credentials from Credential Manager.
18Please find below the working solution for Windows:
- Open Control Panel from the Start menu.
- Select User Accounts.
- Select the "Credential Manager".
- Click on "Manage Windows Credentials".
- Delete any credentials related to Git or GitHub.
- Once you deleted all then try to clone again.
I was also facing the same issue
remote: Repository not found
fatal: repository ' not foundI uninstalled the git credentials manager and reinstalled it and then I could easily pull and push to the repository. Here are the commands
$ git credential-manager uninstall
$ git credential-manager install 8 This message can occur when a repository IS found, but we don't have commit access. Not well-worded!
I received the repo-not-found message after cloning a gitHub repository created for me by my boss. I could clone and commit locally, but could not push commits upstream. The repository owner had not given me write access. Solved by a plea for write access to the repo owner.
5Because you probably did not identify the remote git repository to your terminal first.
git remote set-url origin and then,
git add .
git commit -m "initial commit"
git push origin master 3 This issue here is you local git is not able to push the changes to the remote Check your remote is set correctly by
git remote -vif it is not set properly try setting your remote as
git remote set-url origin Then try pushing using
git push -u origin masterAlso there is a possibility of your local git has different credentials, please check that also.
4On Windows:
- Go to .git folder
- Open 'config' file using notepad or any other editor
- Change your URL from to
Save and Push the code, it will work.
4On Mac
If you are trying to clone the repo.... Then this problem is may occur because you don't have repo present in the github account present in Keychain Access. For resolution try to clone with the account name like
git clone
Replace
- username with your GitHub username
- org with yours organisation name
- repo with repository name
Add "Personal Access Token"
Since since 2021 Github supports PAT rather than name/password (read here how to create and use one) so we just add it into the remote origin.
On Windows
- Visit
.gitfolder and openconfigfile for editing. Eg.vim config. - Change your URL from
to
Where[personal-access-token]is the PAT hash you've created at github. - Save the
configfile and now the push should work.
Shortcut:
git remote remove origin
git remote add origin Update
When generating a token, choose No expiration if you want it to work for long time.
Could happen if you have no write access but only read.
If it's a private repository you should be added as a collaborator.
Check your credentials are correct.
Git won't actually say these things, it would just say that with your credentials no repo was found.
Good luck.
0For Linux users:
git remote rm origin
git remote add origin
For Mac
Open KeyChain Access and find your pssword account on password category ( you can search it on top right keychain access page)
when you find it , delete all keys related to your git source control. and try it again
1The problem here is windows credentials manager, Please goto control panel and search for credentials manager and delete all contents of it regarding github
0In my case none solution above worked.
I solved it by switching remote.origin.url from https to ssh:
verify git configuration:
git config --listshould be like:
...
remote.origin.url=
...update remote.origin.url with ssh to be used:
git remote set-url origin :ORG/repo-name.git 1 You might be logged in with some other GitHub credentials before. Exactly that's why this error is happening.
Usually, mac is storing your GitHub credential to the keychain access tool. Your previous git account details are there. So it is getting mismatched with your current git repo which is in other accounts.
The solution is simple and straight forward,
- Go to keychain access in your mac.
- On the left side under the category you can find all items. Click that.
- Right side top search "git".
- You will get some items regarding Github.
- Delete all those items.
That's it, here you go.
Try to push again. It will ask you the git username and password. Your new credentials will be stored again in the keychain and your push will be done.
Hurray!
Revert back to me, If you need more help.
Thanks
1In our case it was simply a case of giving write rights in github. Initially the user had only read rights and it was giving this error.
1While the previous replies offered various solutions, I found that the easiest one of them is to add the username to the repository's URL
git remote add origin In case you have already defined the repository (without adding the username) you can update it as follows,
git remote set-url origin When pushing to the remote repository git won't pull the credential of any other existing repository from the credential helper, but will ask for the user's/repository's specific password.
As a general note, I'd avoid to use your account's password at all cost and use a personal access token instead. Log in to github and select,
Settings > Developer Settings > Personal Access Tokens > Generate new tokenJust make sure to check repo when defining the token's scope and enter the token (instead of your personal password) when asked for a password.
1I had the same issue after I set up 2FA on my repo. If you recently set up 2FA on your account, here's what I did to solve it:
Generate a personal access token
Go to Settings -> Developer Settings -> Personal Access Tokens on your GitHub account. Generate a new personal access token. Make sure to check all repo-access related permissions.
Delete all GitHub authentication configuration (from keychain for Mac)
You'll need to sign in afresh using the generated Personal Access Token, so clear all previous authentication details from your laptop. For mac, open keychain and delete all github.com related details from the login/passwords section.
Sign in to your terminal with your GitHub username and PAT as password.
If you've set up 2FA on your account, you won't be able to authenticate using your GitHub password from the terminal. Now, attempt to push to a GitHub repo to trigger a need for authentication. A request to enter your GitHub username will pop up on your terminal. Enter your username, and when prompted for a password, use the generated Personal Access Token as password.
These exact steps solved the problem for me.
0I tried everything until I realized the repository owner gave me only READ permissions, so Git would throw "remote: Repository not found".
in my case, i cannot clone github due to user is wrong.
go to ~/.gitconfigthen try to remove this line of code (just delete it then save file).
[user] name = youruser email = or try to use one liner in your cmd or terminal : git config --global --remove-section user
and try to do git clone again. hope it'll fix your day. ><
Solution for this -
Problem -
$ git clone
Cloning into 'def'...
remote: Repository not found.
fatal: repository ' not foundSolution - uninstall the credential manager -
abc@DESKTOP-4B77L5B MINGW64 /c/xampp/htdocs
$ git credential-manager uninstall
abc@DESKTOP-4B77L5B MINGW64 /c/xampp/htdocs
$ git credential-manager installIt works....
I'm facing same issue and resolving through
git add .
git commit -m "message"
git remote set-url origin then
git pull 1 Some times ssh credentials are setup on your pc to communicate with github repos. When you setup new repo: if you add origin in https format, your git credential manager can't figure-out the repo.
check origin format
git remote -vOrigin in https format
origin Origin in ssh format
origin :username/repo_name.gitRemove origin in https format
git remote remove originAdd origin in ssh format
git remote add origin :username/repo_name.git If you are using access key, please give the appropriate permissions while creating access key (I tried with all the permissions and it works)
You are probably trying to push to a private repository. In that case, you will have to ask the admin for Collaborator access to be authenticated.
So your url currently looks like this below
It needs to look like this
The difference is at the beginning of the url i added my github username followed by a @ symbol.
1Disable GIT credential has helped me:
git config --global --unset credential.helper If you are on windows got to control pannel -> windows Credentials then remove github credential from generic credential option. Then try to clone
0Executing git remote update works for me.
I use the gh commandline tool (it's amazing, by the way)
In my case, I was logged in to a different github account. I just needed to run:
gh auth logout
gh auth loginand then go through the authentication flow with the right acount.
1 12 Next