我有一个非常奇怪的问题与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

什么好主意吗?


当前回答

创建一个Fork

如果没有对该存储库的写访问权,则不需要它。按照下面的说明创建一个fork——它是你自己的存储库的克隆,你可以自由修改。

在创建fork之后,您可以将该repo复制到您的计算机。

git clone git@github.com:<your-git-handle>/<repository>.git
// It will be cloned to your machine where you run the command 
// under a <repository> folder that it will create.

签出一个新的分支并进行更改。

git checkout -b my-new-feature

要将更改提交到原始存储库,您需要确保它们已被推送

/* make changes */
git commit -am "New Feature: Made a new feature!"
git push origin my-new-feature

要将这些更改放到派生出来的原始存储库中,您可以按照以下说明提交一个Pull Requests。Pull Request基本上,你请求对存储库有写访问权限的用户下拉你所做的更改。把它想象成“我请求您将我的更改拉到您的回购中。”


注意:尽管如此,您的分支不会与原始存储库中正在进行的所有更改保持最新。您必须定期删除这些更改—但这很容易。

创建分叉后,你可以链接到你已经分叉的回购,这样你就可以拉进它的变化并保持最新。

git remote add upstream git@github.com:<git-user-handle>/<repository>.git

一旦你做到了这一点,保持与原始回购上所做的更改同步是非常容易的。

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

其他回答

问题:由于某些原因,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上的仓库->设置->合作者和团队->添加 成员/维护你的用户->现在他们获得了提交的权限 ,推动

都经历过同样的问题。几年来一切都很正常,然后突然出现了这个错误。

问题是,我在用户的github SSH密钥(我总是用来访问有问题的回购)之前向我的SSH代理添加了另一个回购的部署密钥。SSH代理首先尝试了另一个回购的部署键,而GitHub出于一些完全无法解释的原因说

ERROR: Repository not found.

一旦我从SSH代理中删除了部署键,一切就恢复正常了。

我的一个Github库也有同样的问题。

方法:

使用SSH而不是HTTPS,然后推/拉开始工作正常。

SSH访问检查方法如下:

ssh -T git@github.com

这个问题是因为我没有在存储库中添加SSH上的人响应,阅读更多关于SSH link-1, link-2的信息。

如果有人在github.com上遇到这个问题,检查你是否接受了回购所有者允许提交给你的邀请。直到你接受邀请,回购将是无形的为您。所以你会得到ERROR: Repository not found。