我有一个非常奇怪的问题与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 remote rm origin
git remote add origin https://USERNAME@github.com/username/reponame.git

类似于Emi-C的答案,但没有密码。

其他回答

当我试图推到我以前访问过的私人回购时,我遇到了这个错误。问题不在于回购是私有的还是公共的,问题在于Github API现在使用个人令牌而不是用户名和密码进行身份验证和授权。

以下方法解决了我的问题:

删除远程原点:git远程删除原点 生成一个个人代币:你可以在Github Docs中找到说明。 重新添加原点,但使用您的用户名和生成的令牌:

git远程添加origin https://USERNAME:GENERATED_TOKEN@github.com/username/reponame.git

注意: 如果在创建和使用令牌一段时间后遇到此问题,请确保令牌没有过期。如果是,重新生成它,并确保对使用旧令牌的回购重复第3步(如上所述)。此外,如果您更改了令牌,请为使用旧令牌的repo重做步骤3。

这是如何解决我的问题

#check current github account
ssh -T git@github.com

#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 git@github.com:YOUR-USER/YOUR-REPO.GIT
git push -u origin master

转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称

问题:由于某些原因,Github不熟悉你的存储库。

Error:在git cli中提示如下:

remote:未找到存储库。致命:库 “https://github.com/MyOrganization/projectName.git/”未找到

解决方案:2个选项

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>@github.com/Company/repositoryName.git 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:

去Github上的仓库->设置->合作者和团队->添加 成员/维护你的用户->现在他们获得了提交的权限 ,推动

我也遇到了同样的问题,我通过在回购url中包含我的用户名和密码来解决它:

git clone https://myusername:mypassword@github.com/path_to/myRepo.git