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

什么好主意吗?


当前回答

我的问题是我创建了一个没有权限的个人开发人员令牌

其他回答

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.

转到你的项目文件夹,然后搜索。git文件夹,然后用记事本打开配置文件,检查是否有你的链接到github回购下:[remote "origin"],如果它是不同的,然后在你的github回购,然后编辑它,或在配置文件中打开一个新的回购名称

git remote rm origin
git remote add origin <remote url>

你必须生成SSH密钥,并在设置中添加到你的github帐户中 转到你的项目,在那里你克隆里面运行这些命令

1-ssh keygen -t rsa -b 4096 -C "rajankumar148@gmail.com"

在命令之后,你会得到一些选项,路径和名称可以留空,你可以输入密码。

2-eval $(ssh-agent -s)。

3-ssh-add ~ / . ssh / id_rsa

在这个命令之后,您必须输入与第一个命令中创建的相同的密码

之后,你可以检查你的默认主目录或任何目录,它在终端上显示。pub文件打开并复制密钥和过去在github设置新的SSH

这对我来说很管用:

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回购。