可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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?
回答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.
回答2:
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
回答3:
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.
回答4:
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
回答5:
git remote rm origin git remote add origin
回答6:
I had a similar problem. The incorrect credentials were cached in OS X's key-chain.
Check out: https://help.github.com/articles/updating-credentials-from-the-osx-keychain
回答7:
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 https://github.com/YOUR_USER/your-repo.git git push -u origin master
回答8:
If you belong to a group in Github check that you have Write Access.
回答9:
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
回答10:
This Solved my problem.
git pull https://myusername:[email protected]/path_to/myRepo.git
回答11:
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.
回答12:
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 ! 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.
回答13:
If anybody faced the issue at github.com 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.
回答14:
That's what worked for me:
1. The Remotes
$ git remote rm origin $ git remote add origin [email protected]:/.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.
回答15:
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 ;)
回答16:
If you include your username and the repo name we can reasonably help you, at the moment we have no reason to think the repo does actually exist.
Additionally, if the repo is private and you don't have access to it, github returns "Does not exist" to avoid disclosing the existance of private repos.
EDIT: If you're not able to clone it because it's saying it doesn't exist and it's private, it's because you're not sending authentication. Ensure that your public key is added to your keyring, or use HTTP basic auth for the time being.
回答17:
I had this issue and realized I was using a different account from the one whose repo it was. Logging in as the original user resolved the issue.
回答18:
If you use private repository check you connection user, it must have permission for use repository.
回答19:
I had the same problem. My issue was misunderstanding that I had to first create the empty repo on github before pushing to it. Doh! Including this here for anyone else who doesn't realize.
回答20:
go to your project folder then search for the .git folder, then open the config file with notepad and check if there is your link to the github repo under: [remote "origin"], if it is different then the repo in your github then just edit it, or open a new repo with the name in the in config file
回答21:
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.
回答22:
My solution may be useful to some of you.
I got the same error after updating my macbook's OS to Yosemite. My problem got fixed by recreating my ssh key. You can do this by following step 2 of this page: https://help.github.com/articles/generating-ssh-keys/
回答23:
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
回答24:
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
回答25:
I faced same error after updating my ubuntu to next version
I just deleted my sshkey on github account and then re added an sshkey to that account.
回答26:
I was getting the same error coz I change my github user name, then I do this:
git remote -v
then:
git remote set-url newname newurl git push -u origin master
this time I was able to push to the repository. I hope this helps.
回答27:
first Create a new repository on the command line, name like Ademo.git
Create a new repository on the command line
touch README.md git init git add README.md git commit -m "first commit" git remote add origin https://github.com/your_name/Ademo.git git push -u origin master
Push an existing repository from the command line
git remote add origin https://github.com/your_name/Ademo.git git push -u origin master
回答28:
Create a Fork
If don't have write access to that repository, you don't need it. Create a fork by following these instructions -- it's your own clone of the repository which you can modify freely.
After creating the fork, you can then clone that repo to your computer.
git clone [email protected]:/.git // It will be cloned to your machine where you run the command // under a folder that it will create.
Checkout a new branch and make changes.
git checkout -b my-new-feature
To submit your changes to the original repository, you'll need to make sure that they're pushed
/* make changes */ git commit -am "New Feature: Made a new feature!" git push origin my-new-feature
To get these changes into the original repository that you forked from, you can submit a Pull Requests by following these instructions. A Pull Request basically, you request that the user with write access to a repository pull down the changes you've made. Think of it like "I request that you pull my changes into your repo."
Note: Your fork will not stay up-to-date with all of the changes going on in the original repository, though. You'll have to pull down those changes periodically -- but this is easy.
After creating the fork, you can link to repo that you've forked from so that you can pull in it's changes and keep stay current.
git remote add upstream [email protected]:/.git
Once you've done that, keeping in sync with the changes made on the original repo is quite easy.
git checkout master // checkout your local master git pull upstream master // fetch changes from the master branch of the repo you forked from.. which is linked to your fork under the alias "upstream" (common naming convention) git push origin master // push the pulled changes onto your local master git checkout -b new-branch // create a new branch and start making changes
回答29:
Also be sure to check whether you have desktop client installed. I double checked everything, my permission, SSH, but turns out my repo listed in the client was overriding the one I was inputting via terminal.
回答30:
So for me, my password had a ` (tick) in it and PhpStorm was removing the character before sending the git push:
Lets say for this example my password is _pa``ssword_
Phpstorm would output the following:
https://_username_:[email protected]/_username_/repo.git
instead of
https://_username_:_pa``[email protected]/_username_/repo.git
Changed password to something not using the ` character. WORKS!!!