简体   繁体   中英

pushing to remote private repo : fatal: repository not found

I successfully cloned remote private repo via

git clone https://github.com/notMyUsername/repoName

I recieved all the files from the repo - so there is no mistake in url

but when I am trying to push I get next errors:

$ git push --dry-run
remote: Repository not found.
fatal: repository 'https://github.com/notMyUsername/repoName/' not found

$ git push origin --dry-run
remote: Repository not found.
fatal: repository 'https://github.com/notMyUsername/repoName/' not found

$ git remote -v
origin  https://github.com/notMyUsername/repoName (fetch)
origin  https://github.com/notMyUsername/repoName (push)

I also received notification from github for this repo, which tells that "You were automatically subscribed because you've been given push access to the repository." So I have rights.

What's wrong here?

You probably don't have push rights on the GitHub repo, or you're not authenticated at all (but because you cloned, I assume you're authenticated).

As described by GitHub ( https://developer.github.com/v3/troubleshooting/ ), the GitHub API returns 404 for errors, not 403:

Why am I getting a 404 error on a repository that exists?

Typically, we send a 404 error when your client isn't properly authenticated. You might expect to see a 403 Forbidden in these cases. However, since we don't want to provide any information about private repositories, the API returns a 404 error instead.

To troubleshoot, ensure you're authenticating correctly, your OAuth access token has the required scopes, and third-party application restrictions are not blocking access.

You can only push to your own repositories on GitHub unless the repository owner has given you the right to push to that repository.

I contacted github support and they told me to check my git credentials in Windows Credential Manager if I am using a windows machine. Seems that somehow the git credentials were incorrect. I corrected the credentials and push worked. In a mac i guess the keychain would have the credentials.

Now it fixed, and I did nothing(only wrote a message to the github support). And I saw some similar questions here on stackoverflow, where only time helped too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM