我有一个非常奇怪的问题与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
什么好主意吗?
当前回答
git remote rm origin
git remote add origin <remote url>
其他回答
在执行此操作之前,请确保您拥有对回购的写权限。如果您仍然得到错误,请执行以下操作:
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.
这对我来说很管用:
1. 的遥控器
$ git remote rm origin
$ git remote add origin git@github.com:<USER>/<REPO>.git
如果您的SSH密钥已经在另一个github代表上使用,您可以生成一个新密钥。
2. 生成新的SSH密钥
$ ssh-keygen -t rsa -b 4096 -C "web@github.com"
3.在SSH代理级别添加密钥
$ eval "$(ssh-agent -s)"
$ ssh-add ~/.ssh/id_rsa_github
4. 将新密钥添加到Github回购。
当我试图推到我以前访问过的私人回购时,我遇到了这个错误。问题不在于回购是私有的还是公共的,问题在于Github API现在使用个人令牌而不是用户名和密码进行身份验证和授权。
以下方法解决了我的问题:
删除远程原点:git远程删除原点 生成一个个人代币:你可以在Github Docs中找到说明。 重新添加原点,但使用您的用户名和生成的令牌:
git远程添加origin https://USERNAME:GENERATED_TOKEN@github.com/username/reponame.git
注意: 如果在创建和使用令牌一段时间后遇到此问题,请确保令牌没有过期。如果是,重新生成它,并确保对使用旧令牌的回购重复第3步(如上所述)。此外,如果您更改了令牌,请为使用旧令牌的repo重做步骤3。
转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称
另外,一定要检查是否安装了桌面客户端。我仔细检查了一切,我的权限,SSH,但原来我在客户端列出的回购覆盖了我通过终端输入的。