问题
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.
回答1:
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.
回答2:
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
回答3:
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 "force push"
git push origin master --force
回答4:
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.
回答5:
Please find below the working solution:
- 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.
回答6:
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://username@github.com/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.
回答7:
The problem here is windows credentials manager, Please goto control panel and search for credentials manager and delete all contents of it regarding github
回答8:
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.
回答9:
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
回答10:
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
回答11:
So your url currently looks like this below
https://github.com/RevanthM/Log_Monitoring
It needs to look like this
https://RevanthM@github.com/RevanthM/Log_Monitoring
The difference is at the beginning of the url i added my github username followed by a @ symbol.
回答12:
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.
回答13:
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/).
回答14:
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.
回答15:
I solved it by deleting the .git
file (hidden folder) and then uploading it again.
回答16:
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 }
回答17:
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.
回答18:
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.
回答19:
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.
回答20:
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.
回答21:
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 = youruser@domain.com
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. ><
回答22:
You can try deleting the .git
file in the directory and doing everything again will fix your problem!
回答23:
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!
回答24:
I also had that issue. To solve that I: 1. Moved my local .dotfiles away to _.dotfiles_bak 2. Cloned my remote git repository 3. Copied all my files from _.dotfiles_bak to .dotfiles - except the .git folder 3. Then I could work locally again: Editing, committing and pushing
来源:https://stackoverflow.com/questions/37813568/git-remote-repository-not-found