Git - remote: Repository not found
GitGithubAtlassian SourcetreeGit Problem Overview
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 'https://github.com/MyRepo/project.git/' not found
I am not sure what can be an issue.
Git Solutions
Solution 1 - Git
Remove the all github.com credential details from the system.
For mac
Delete the github.com password from the Keychain Access.
For window
Delete the credentials from Credential Manager.
Solution 2 - Git
Please 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.
Solution 3 - Git
I was also facing the same issue
remote: Repository not found
fatal: repository 'https://github.com/MyRepo/project.git/' not found
I 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
Solution 4 - Git
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.
Solution 5 - Git
Because you probably did not identify the remote git repository to your terminal first.
git remote set-url origin https://github.com/MyRepo/project.git
and then,
git add .
git commit -m "initial commit"
git push origin master
Solution 6 - Git
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 -v
if it is not set properly try setting your remote as
git remote set-url origin https://[email protected]/MyRepo/project.git
Then try pushing using
git push -u origin master
Also there is a possibility of your local git has different credentials, please check that also.
Solution 7 - Git
On Windows:
- Go to .git folder
- Open 'config' file using notepad or any other editor
- Change your URL from https://github.com/username/repo_name.git to https://username:[email protected]/username/repo_name.git
Save and Push the code, it will work.
Solution 8 - Git
On 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 https://[email protected]/org/repo.git
Replace
- username with your GitHub username
- org with yours organisation name
- repo with repository name
Solution 9 - Git
-
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.
Solution 10 - Git
For Linux users:
git remote rm origin
git remote add origin https://GITHUB_USERNAME:[email protected]/username/reponame.git
Solution 11 - Git
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
Solution 12 - Git
The problem here is windows credentials manager, Please goto control panel and search for credentials manager and delete all contents of it regarding github
Solution 13 - Git
In my case none solution above worked.
I solved it by switching remote.origin.url
from https to ssh:
verify git configuration:
git config --list
should be like:
...
remote.origin.url=https://github.com/ORG/repo-name.git
...
update remote.origin.url
with ssh to be used:
git remote set-url origin git@github.com:ORG/repo-name.git
Solution 14 - Git
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
.git
folder and openconfig
file for editing. Eg.vim config
. - Change your URL from
https://github.com/<username>/<repo_name>.git
to
https://[personal-access-token]@github.com/<username>/<repo_name>.git
Where[personal-access-token]
is the PAT hash you've created at github. - Save the
config
file and now the push should work.
Shortcut:
git remote remove origin
git remote add origin https://[personal-access-token]@github.com/username/repo_name.git
Update
When generating a token, choose No expiration if you want it to work for long time.
Solution 15 - Git
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
Solution 16 - Git
In 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.
Solution 17 - Git
While 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 https://[email protected]/your-username/repository-name.git
In case you have already defined the repository (without adding the username) you can update it as follows,
git remote set-url origin https://[email protected]/your-username/respository-name.git
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 token
Just 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.
Solution 18 - Git
I 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.
Solution 19 - Git
I tried everything until I realized the repository owner gave me only READ permissions, so Git would throw "remote: Repository not found".
Solution 20 - Git
in my case, i cannot clone github due to user is wrong.
go to ~/.gitconfig
then try to remove this line of code (just delete it then save file).
[user]
name = youruser
email = [email protected]
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 21 - Git
Solution for this -
Problem -
$ git clone https://github.com/abc/def.git
Cloning into 'def'...
remote: Repository not found.
fatal: repository 'https://github.com/abc/def.git/' not found
Solution - 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 install
It works....
Solution 22 - Git
I'm facing same issue and resolving through
git add .
git commit -m "message"
git remote set-url origin https://YOUR_GITHUB_USER@github.com/aceofwings/RotairERP.git
then
git pull
Solution 23 - Git
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 -v
Origin in https format
origin https://github.com/username/repo_name.git
Origin in ssh format
origin git@github.com:username/repo_name.git
Remove origin in https format
git remote remove origin
Add origin in ssh format
git remote add origin git@github.com:username/repo_name.git
Solution 24 - 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)
Solution 25 - Git
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.
Solution 26 - Git
Disable GIT credential has helped me:
git config --global --unset credential.helper
Solution 27 - Git
If you are on windows got to control pannel -> windows Credentials then remove github credential from generic credential option. Then try to clone
Solution 28 - Git
Executing git remote update
works for me.
Solution 29 - Git
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 login
and then go through the authentication flow with the right acount.
Solution 30 - Git
So your url currently looks like this below
https://github.com/RevanthM/Log_Monitoring
It needs to look like this
https://[email protected]/RevanthM/Log_Monitoring
The difference is at the beginning of the url i added my github username followed by a @ symbol.
Solution 31 - Git
I was facing this error in VS code because I was using VS code git extension. It saves my git credentials on Linux key-ring. While I wanted to git pull from another account which has access to the repository. The most simple solution is to open the Linux shell (not the one integrated in VS code) and then run:
git pull origin master
This time, it will ask you the username and password of Github.
Solution 32 - Git
You must generate a new token: here the steps https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
remove control at origin locally
git remote remove origin
add it again but now with your generated token
git remote add origin https: // <token> @ <git_url> .git
and push it
git pull https://
note:
what is git_url? is the url of your current project example: github.com/yourUser/yourProy
and delete the <>
characters
Solution 33 - Git
It is probably a matter of authentication. SourceTree caches your github credentials (that are used to access the repository by https) but from terminal you have to either configure git with the credentials (https://help.github.com/articles/creating-an-access-token-for-command-line-use/) or use git+ssh and a ssh key pair (https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/).
Solution 34 - Git
I have faced the same issue in my Windows10 system.
The Problem here is the Username you are having in the system. You can resolve it using
git credential-manager uninstall
git credential-manager install
If it doesn't work then you have to install ubuntu
in your system which is available at the App Store.
In that ubuntu terminal, I force push the repository and It worked after asking me the Username and Password
strong text
Solution 35 - Git
I was trying to clone a repo and was facing this issue, I tried removing all git related credentials from windows credentials manager
after that while trying to clone git was asking me for my credentials and failing with error invalid username or password
. This was happening because the repo I was trying to clone was under an organization on github and that organization had two factor auth enabled and git bash probably do not know how to handle 2fa. So I generated a token from https://github.com/settings/tokens and used the github token instead of password while trying to clone the repo and that worked.
Solution 36 - Git
I had other existing github repositories but I mistakenly thought that I could create the repository using git commands. I thought that my problem was not having a Personal Access Token but I was still not able to push using commands below for creating my repository.
git init
git add README.md
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/username/project.git
git push -u origin main
I continually got:
remote: Repository not found.
fatal: repository 'https://github.com/username/project.git/' not found
in response to
git push -u origin main
However, I found that the repository needed to be created using the github cli or at their github site after logging into my account. Once I did this, everything worked like a charm.
Below is the link where I discovered that I could not create a github repository with git commands.
Solution 37 - Git
In my case I needed to open the directory on Linux using Ctrl + H to see the hidden documents, so I got into to the Git config and took out the .git
in the URL.
Solution 38 - Git
I solved it by deleting the .git
file (hidden folder) and then uploading it again.
Solution 39 - Git
I had the same issue and found out that I had another key file in ~/.ssh
for a different GitHub repository. Somehow it was used instead of the new one.
Solution 40 - Git
Check if the url s.source is correct.
Example for me
// fail Project>>t<<est
s.source = { :git => '.../Projecttest-iOS', :tag => s.version.to_s }
// success Project>>T<<est
s.source = { :git => '.../ProjectTest-iOS', :tag => s.version.to_s }
Solution 41 - Git
For my team it was a permissions issue. In the GitHub settings, it was set to Read mode for all members in our team. Once we changed the drop down to Write, we were all able to clone and push back successfully.
Solution 42 - Git
If you are using Git Desktop application than you should try to push and pull form git desktop app instead of terminal. It will help you.
Solution 43 - Git
I'm seeing this fatal: repository not found error more often now as people try and push and pull from private GitHub accounts on the free tier. These are the most common solutions to the problem:
- You did not authenticate
- Your password has changed
- You are not a collaborator
- Incorrect case or a word misspelled
- The git repository has been deleted
Windows Credentials Manager?
Sometimes Windows Credentials Manager caches your u/p and passes it along behind the scenes. If you've changed your password recently, or are using a different username, you might need to go into the credentials manager and clear your existing entries for GitHub.
Solution 44 - Git
You can try deleting the .git
file in the directory and doing everything again will fix your problem!
Solution 45 - Git
I had the same issue
It was resolved by checking the http.proxy value in git config (mine was incorrect and unwanted), Hence I removed http.proxy value from git config
commands:
List down the config items in the file
git config --list
Remove the proxy
git config --global --unset http.proxy
The problem was solved!
Solution 46 - Git
I also had that issue. To solve that I:
- Moved my local .dotfiles away to _.dotfiles_bak
- Cloned my remote git repository
- Copied all my files from _.dotfiles_bak to .dotfiles - except the .git folder
- Then I could work locally again: Editing, committing and pushing
Solution 47 - Git
This happens when the repository, team name or username changes.
There is one solution (that I know): revert the repository name.
Solution 48 - Git
Try this, it worked for me.
git remote rm origin
git remote add origin https://github.com/your-username/{{project-name}}.git
Solution 49 - Git
If repo is private make sure you have accepted the repo invitation. If repo is private without accepting the repo invitaion if you will directly push changes it gives the same error.
Solution 50 - Git
None of the other answers worked for me, and I could view the repo in the browser but got the Not Found error when trying to fetch or do a new clone. For some reason, this fixed it:
- Visit Github repo in web browser.
- Click on the green "Code" button (picture below).
- Select Open with Github desktop.
- Github desktop should open and successfully fetch.
- You can now close Github desktop and fetch or clone from the console or your Git software of choice.
Solution 51 - Git
I faced the same issue but when I found out that I have created the repository from another account and try to push the code from another account. That's it now I just had to give the access to another account and problem solved. You would find to give the access from
Setting > Contributors > Add People
Solution 52 - Git
On ubuntu, I faced this issue. I solved this by resetting credential helper, by running this command below.
git config credential.helper ""
after running this command, when you pull or push, you will be asked to input your credential again.