我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:
git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我添加了遥控器:
git remote add origin git@github.com:account-name/repo-name.git
什么好主意吗?
我有一个非常奇怪的问题与git和github。当我试着推的时候,我得到:
git push -u origin master
ERROR: Repository not found.
fatal: The remote end hung up unexpectedly
我添加了遥控器:
git remote add origin git@github.com:account-name/repo-name.git
什么好主意吗?
当前回答
所以对我来说,我的密码有一个'(勾),PhpStorm在发送git推送之前删除了这个字符:
在这个例子中,我的密码是_pa ' ' ssword_
Phpstorm将输出以下内容:
https://_username_:_password_@github.com/_username_/repo.git
而不是
https://_username_ _pa“ssword_@github.com/_username_/repo.git
将密码更改为不使用'字符的密码。工作! !
其他回答
对我来说,这些回答都没用。 我只是忘记在远程(github.com)上创建回购。所以我在网上创建了我的回购,用同样的名字,然后重新做
所以,这是整个故事:
git init ...
git add ...
git commit ...
git remote add origin git@github.com:<myName>/<myRepo>.git
git push -u origin main
ERROR: Repository not found.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这里你需要在github.com上添加你的回购,使用相同的“myRepo”名称
git push -u origin main
有类似的问题。问题的根源是我遵循了一些关于向Github添加新存储库的在线教程。
只要去Github,创建一个新的repo,它会要求你添加一个README,不要添加它。创建它,你会得到如何推送的指导。
它类似于接下来的两行:
git remote add origin https://github.com/YOUR_USER/your-repo.git
git push -u origin master
如果你使用https从github克隆,但你使用ssh推送,你也会得到这个错误。
要纠正这个问题,打开.git/config并替换:
Url = https://github.com/company/project.git
With
Url = git@github.com:company/project.git
你应该可以在没有任何警告的情况下推…
eval "$(ssh-agent -s)"
这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。
转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称