我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
我在更新ubuntu到下一个版本后遇到了同样的错误
我刚刚删除了我的sshkey在github帐户,然后重新添加了一个sshkey到该帐户。
其他回答
在执行此操作之前,请确保您拥有对回购的写权限。如果您仍然得到错误,请执行以下操作:
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.
转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称
自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
确保你删除了这个或授予你的动作内容:如果你需要推送一个标签或提交发行说明和包碰撞,写许可。
我的解决办法是:
git remote rm origin
git remote add origin https://USERNAME@github.com/username/reponame.git
类似于Emi-C的答案,但没有密码。
我的一个Github库也有同样的问题。
方法:
使用SSH而不是HTTPS,然后推/拉开始工作正常。