我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
当我试图推到我以前访问过的私人回购时,我遇到了这个错误。问题不在于回购是私有的还是公共的,问题在于Github API现在使用个人令牌而不是用户名和密码进行身份验证和授权。
以下方法解决了我的问题:
删除远程原点:git远程删除原点 生成一个个人代币:你可以在Github Docs中找到说明。 重新添加原点,但使用您的用户名和生成的令牌:
git远程添加origin https://USERNAME:GENERATED_TOKEN@github.com/username/reponame.git
注意: 如果在创建和使用令牌一段时间后遇到此问题,请确保令牌没有过期。如果是,重新生成它,并确保对使用旧令牌的回购重复第3步(如上所述)。此外,如果您更改了令牌,请为使用旧令牌的repo重做步骤3。
其他回答
问题:由于某些原因,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上的仓库->设置->合作者和团队->添加 成员/维护你的用户->现在他们获得了提交的权限 ,推动
我也遇到了同样的问题,尝试了很多方法,但最后,我知道我没有足够的权限来推或拉这个回购,还有一种方法来检查你是否有权限,你无法看到该回购中的设置选项,如果你有权限,那么你将能够看到设置选项
谢谢!这是我观察到的
在执行此操作之前,请确保您拥有对回购的写权限。如果您仍然得到错误,请执行以下操作:
Generate a personal access token from your account from Settings > Developer Settings > Personal Access tokens. Keep the token safe somewhere. Go to your repository and run the following: git remote rm origin Then add a new origin along with your username: git remote add origin https://USERNAME@github.com/REPOSITORY_LINK.git Now when you push the code, a prompt will show up asking for your password or personal access token. Paste the token that we generated in the first step in the field, and we're done.
只需使用SSH远程url,而不是HTTPS
我可以解释我是如何陷入类似的情况,然后列出我已经采取的步骤来解决这个问题。
我在用 Windows 10, Git: Git版本2.27.0.windows.1。
我已经安装了git,正在做git推送活动。Windows凭据管理器存储用户名和密码,所以你不必每次git远程活动都输入用户名和密码。
遇到这个问题,当我添加了另一个github帐户和使用——本地git设置。几天后,我遇到了存储库找不到的问题,经过调查我发现:
即使你从Windows凭证管理器中删除了git详细信息,它也会再次保存你输入的用户名、电子邮件详细信息。
因此,如果您使用两个git帐户,则需要使用(以管理员身份使用git bash)
git config --edit --system
然后移除
helper = manager
行,使其不再注册为凭据帮助器。但是每次你进行远程活动时,它都会询问你登录的详细信息。
如何禁用Git凭证管理器的Windows?
检查远程源、用户详细信息
git config --list --show-origin