[Solved] Git Push ERROR: Repository not found

I am having a very strange problem with git and github. When I try and push, I am getting:

git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly

I added the remote:

git remote add origin [email protected]:account-name/repo-name.git

Any ideas?

Enquirer: Justin


Solution #1:

Check to see if you have read-write access.

The Git error message is misleading. I had a similar issue. I had been added to an existing project. I cloned it and committed a local change. I went to push and got the ERROR: Repository not found. error message.

The person who added me to the project gave me read-only access to the repository. A change by them and I was able to push.

Respondent: JT.

Solution #2:

I had the same problem, with a private repo.

do the following:

remove the remote origin

git remote rm origin

re-add the origin but with your username and pwd with writing privileges on this pvt repo

git remote add origin  https://USERNAME:[email protected]/username/reponame.git
Respondent: Emi-C

Solution #3:

I ran into the same issue and I solved it by including my username and password in the repo url:

git clone https://myusername:[email protected]/path_to/myRepo.git
Respondent: George Eracleous

Solution #4:

I was getting the same error

ERROR: Repository not found.   
fatal: The remote end hung up unexpectedly

and I had created the repository on Github and cloned it locally.

I was able to solve by opening .git/config and removing the [remote "origin"] section.

[remote "origin"]   
   url = [email protected]:alexagui/my_project.git  
   fetch = +refs/heads/*:refs/remotes/origin/*

then I ran the following (again)

git remote add origin [email protected]:alexagui/my_project.git  
git push -u origin master

and this time I was able to push to the repository.

Respondent: Alex Aguilar

Solution #5:

If you use Git on Windows, try to clear your credentials:

  1. Locate “credential manager” (should be in your Control Panel)
  2. Remove all credentials related to GitHub

enter image description here

Respondent: SandroMarques

Solution #6:

I got this error (but before was working). My problem was the missing ssh key binded with the Github account. You can check you current ssh keys with ssh-add -l.

If your key is missing, you can add it with

ssh-add ~/.ssh/your_key
Respondent: Matteo Alessani

Solution #7:

git remote rm origin
git remote add origin <remote url>
Respondent: Kirill Evgenevich

Solution #8:

I had a similar problem. The incorrect credentials were cached in OS X’s key-chain.

Check out:

Respondent: Nikola

Solution #9:

I’m using Mac and I struggled to find the solution.
My remote address was right and as said, it was a credentials problem.
Apparently, in the past I used another Git Account on my computer and the mac’s Keychain remembered the credentials of the previous account, so I really wasn’t authorised to push.

How to fix?
Open Keychain Access on your mac, choose “All Items” category and search for git.
Delete all results found.

Now go to the terminal and try to push again. The terminal will ask for username and password. Enter the new relevant credentials and that’s it!

Hope it’ll help someone. I struggled it for few hours.

Respondent: Gal Shahar

Solution #10:

remote: Repository not found. can be a frustratingly misleading error message from when trying to push to an HTTPS remote where you don’t have write permissions.

Check your write permissions on the repository!

Trying an SSH remote to the same repository shows a different response:

% git remote add ssh [email protected]:our-organisation/some-repository.git

% git fetch ssh
* [new branch]        MO_Adding_ECS_configs             -> ssh/MO_Adding_ECS_configs
* [new branch]        update_gems                       -> ssh/update_gems

% git push ssh     
ERROR: Repository not found.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

“The correct access rights?”

Well why didn’t you say so?

It’s worth noting at this point that while the SSH failure mode in this scenario
is slightly better, I use HTTPS remotes over SSH because
GitHub recommend HTTPS over SSH.

I understand that GitHub uses “Not Found” where it means “Forbidden” in some
circumstances to prevent inadvertently reveling the existence of a private

Requests that require authentication will return 404 Not Found, instead of
403 Forbidden, in some places. This is to prevent the accidental leakage of
private repositories to unauthorized users.


This is a fairly common practice around the web, indeed it is defined:

The 404 (Not Found) status code indicates that the origin server did not find
a current representation for the target resource or is not willing to
disclose that one exists.

6.5.4. 404 Not Found, RFC 7231 HTTP/1.1 Semantics and Content (emphasis mine)

What makes no sense to me is when I am authenticated with GitHub using a
credential helper
and I have access to that repository (having successfully cloned and fetched
it) that GitHub would choose to hide its existence from me because of missing
write permissions.

Checking using a web
browser confirmed that I didn’t have write permissions to the repository. Our
team’s GitHub administrators were able to grant my team write access in a short
time and I was able to push the branch up.

Respondent: Johnsyweb

Solution #11:

If your repo was working normally before, and suddenly this error pops up, most likely the reason would be that your git is authenticated as some other user, that does not have access to the repository. So, in order to push, all you need to do is, specify your correct username and password in your git command. So, a push command for a github repo would look like:

git push https://youruser:[email protected]/user/reponame.git

username and password needs to be url-escaped, so an @ should be replaced by %40, and so on.

Respondent: MrClan

Solution #12:

That’s what worked for me:

1. The Remotes

$ git remote rm origin
$ git remote add origin [email protected]:<USER>/<REPO>.git

If your SSH key is already in use on another github rep, you can generate a new one.

2. Generating a new SSH key

$ ssh-keygen -t rsa -b 4096 -C "[email protected]"

3. Addition of the key at the SSH agent level

$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa_github

4. Add the new key to the Github repo.

Respondent: 120DEV

Solution #13:

If you belong to a group in Github check that you have Write Access.

Respondent: Eduardo Chongkan

Solution #14:

One problem, that may be obvious to some that I don’t see mentioned here, could be that you have access with ssh keys, but you are trying to connect your local repo to a remote via https.

If this is the case then the following commands should fix the issue for you:

$ git remote -v
origin (fetch)
origin (push)
$ git remote rm origin
$ git remote add origin [email protected]:private-repo.git
$ git remote -v
origin  [email protected]:private-repo.git (fetch)
origin  [email protected]:private-repo.git (push)

Note that the above works assuming that:

  1. your current remote is named origin and that you do already have a
    generated ssh key connected with your github account

  2. you already have an ssh key associated with your github account (and connected locally)

  3. you have the correct permissions (read/write) set on github for this repo’s settings.

Respondent: John Donner

Solution #15:

Had similar issue. The root of the problem was that I followed some online tutorial about adding a new repository to Github.

Just go to Github, create a new repo, it will ask you to add a README, don’t add it. Create it, and you’ll get instructions on how to push.

It’s similar to the next two lines:

git remote add origin
git push -u origin master
Respondent: valk

Solution #16:

This Solved my problem.

   git pull https://myusername:[email protected]/path_to/myRepo.git
Respondent: Eyad Farra

Solution #17:

I ran into the same issue on a MAC trying to pull from a private repo i was previously connected to.

I solved it by including my username in the repo url:

git remote set-url origin https://<YOUR_USER_NAME_HERE><YOUR_USER_NAME_HERE>/<REPO>.git

Then i was able to pull from the repo.

For a new repo you want to clone:

git clone https://<YOUR_USER_NAME_HERE><YOUR_USER_NAME_HERE>/<REPO>.git    

It will prompt you to enter your password to that account, you’re good to go afterwards.

Respondent: davyCode

Solution #18:

The Problem: Github is not familiar with your repository from some reason.

The Error: prompted in git cli like the following:

remote: Repository not found. fatal: repository’ not found

The Solution : 2 Options

  1. Github might not familiar with your credentials: – The first Option is to clone the project with the right credentials user:password in case you forgot this Or generate ssh token and adjust this key in your Github. aka git push https://<userName>:<password>

  2. Repo Permissions Issue with some users – In my Use case, I solved this issue when I realized I don’t have the right collaborator permissions on Github in my private repo. Users could clone the project but not perform any actions on origin. In order to solve this:

Go to Repository on Github -> Settings -> Collaborators & Teams -> Add
Member/Maintainer your users -> Now they got the permission to commit
and push

Respondent: avivamg

Solution #19:

You need to check your SSH access as the following:

ssh -T [email protected]

this issue was because i don’t add the person response on SSH in repository, read more about SSH link-1, link-2.

Respondent: Mohamed Yakout

Solution #20:

Have experienced the same problem. Everything was working fine for years and then suddenly this error.

The problem turns out was that I added a deploy key for another repo to my SSH agent before my user’s github SSH key (which I always used to access the repo in question). SSH agent tried the deploy key for another repo first, and GitHub for some totally unexplainable reason was saying

ERROR: Repository not found.

Once I’ve removed the deploy key from SSH agent, everything was back to normal.

Respondent: snovity

Solution #21:

The following solved the problem for me.

First I used this command to figure what was the github account used:

ssh -T [email protected]

This gave me an answer like this:

Hi <github_account_name>! You've successfully authenticated, but GitHub does not provide shell access. I just had to give the access to fix the problem.

Then I understood that the Github user described in the answer (github_account_name) wasn’t authorized on the Github repository I was trying to pull.

Respondent: Stéphane

Solution #22:

Here is how to solve my issue

#check current github account
ssh -T [email protected]

#ensure the correct ssh key used with github
ssh-agent -s
ssh-add ~/.ssh/YOUR-GITHUB-KEY

#re-add the origin
git remote add origin [email protected]:YOUR-USER/YOUR-REPO.GIT
git push -u origin master
Respondent: Nam G VU

Solution #23:

I had the same problem. Try the following:

1. Modifying the Keychain Access in Mac for git credentials solved the problem for me.
2. Resetting origin url

git remote rm origin
git remote add origin [email protected]:account-name/repo-name.git

Solution #24:

If you clone from github using https but you are using ssh to push, you can also get this error.

To correct this, open .git/config and replace:

url =


url = [email protected]:company/project.git

And you should be able to push with no warning…

Respondent: Neil

Solution #25:

I was having the same issue with one of my Github Repository.

Way around:

Used SSH instead of HTTPS and then push/pull started working fine.

Respondent: Safeer

Solution #26:

Changing the content of the .git/config file helps as Alex said above. I experienced the same problem and I think it was because I changed my Github username. The local files could not be updated with the changes. So perhaps anytime you change your username you might consider running

git remote add origin your_ssh_link_from_github

I hope this helps 😉

Respondent: Yaw Boakye

Solution #27:

If anybody faced the issue at check if you have accepted an invitation after repo owner allowed commits to you. Until you accept invitation repo will be invisible for you. So you’ll get ERROR: Repository not found.

Respondent: zelibobla

Solution #28:

I can explain how i get into the similar situation, and then will list steps that i have taken to solve this issue.

I am using
Windows 10,
git: git version

I had already setup the git and was doing git push activities. Windows Credential Manager stores the username and password so you don’t have to enter username and password every git remote activities.

The encounter this problem, when i added another github account and used –local git settings. After few days, I encounter the Repository not found problem, upon investigation i found:

  1. Even if you remove the git details from Windows Credential Manager, it will save again the username, email details you enter.

So, if you are using two git accounts, you need to use (git bash as an administrator)

git config --edit --system 

and remove the

helper = manager 

line so that it is no longer registered as a credential helper. But it will ask you login details every time you do any remote activities.

How do I disable Git Credential Manager for Windows?.

To check remote origin, user details

git config --list --show-origin
Respondent: gs1208

Solution #29:

Just use the SSH remote url instead of the HTTPS

Respondent: Misterwyz

Solution #30:

To solve this problem (on Linux), I merely had to run this:

git config --global --unset credential.helper
Respondent: ktolbol

The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .

Most Popular

To Top
India and Pakistan’s steroid-soaked rhetoric over Kashmir will come back to haunt them both clenbuterol australia bossier man pleads guilty for leadership role in anabolic steriod distribution conspiracy