我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
如果您确定已经拥有对这个存储库的SSH访问权限。
Do
git clone https://myusername@github.com/path_to/myRepo.git
其他回答
Normally it happens because the project is private and you have not rights to write it. I had the same "problem" a few times, and it was for that reason. If the project it is yours, just create a private and a public key following this link: https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent and add them to the "SSH and Key" section on gitHub, then you will be able to push to the repo. In the other hand if the project it is not your, ask the owner to give you the rights for it.
自2021年5月以来,我(和许多其他人)就遇到了这个问题。 有些东西似乎已经改变了行动/checkout@v2 (GitHub问题:https://github.com/actions/checkout/issues/254)
我通过使用此步骤更改运行程序对回购进行身份验证的方式来解决这个问题。
- name: Bump version
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
npm run release
git remote rm origin
git remote add origin https://${{github.actor}}:${{secrets.GITHUB_TOKEN}}@github.com/project/repo.git
git remote -v # for debug only
git show-ref # for debug only
git push --follow-tags origin HEAD:master
所有你需要做的是改变回购url。用户名和密码将在运行时由GitHub运行器替换。这适用于actions/checkout@v1和actions/checkout@v2(还没有测试其他)。
此外,你在网上找到的许多代码片段已经带有权限限制,这将阻止你推回回购
permissions:
packages: write
contents: read
确保你删除了这个或授予你的动作内容:如果你需要推送一个标签或提交发行说明和包碰撞,写许可。
如果你在vscode之前所有的东西都自动化了,现在它不再工作了,试着在vscode上注销你连接的github帐户,然后再登录到有权访问该存储库的正确的github帐户。
这里是你签出和签回的地方。
我试了所有的办法,但似乎都不管用。进一步的研究表明:
这里有一个解决问题的综合方法。 当你数到5。修复4,注意VS代码会要求认证。
如果您输入了密码,仍然得到身份验证错误,请执行以下操作。
转到你的GitHub菜单做设置->开发人员设置->个人访问令牌->生成新的令牌。并确保这些框都是按照下图选中的。生成一个访问令牌并将其保存在可访问的地方。 使用生成的令牌而不是密码。 然后继续执行步骤6。修复5
这些步骤可以在事后解决问题。
只需使用SSH远程url,而不是HTTPS