我有一个非常奇怪的问题与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检查你有写访问权。
其他回答
一个问题,这可能是显而易见的一些,我没有看到这里提到,可能是你有ssh密钥访问,但你正试图通过https连接你的本地回购到远程。
如果是这种情况,那么下面的命令应该可以解决这个问题:
$ git remote -v
origin https://github.com/private-repo.git (fetch)
origin https://github.com/private-repo.git (push)
$ git remote rm origin
$ git remote add origin git@github.com:private-repo.git
$ git remote -v
origin git@github.com:private-repo.git (fetch)
origin git@github.com:private-repo.git (push)
请注意,上述工作的前提是: 您当前的远程名为origin,并且您已经拥有 生成SSH密钥连接到您的github帐户 你已经有一个SSH密钥与你的github帐户相关联(并在本地连接) 你有正确的权限(读/写)设置在github为这个回购的设置。
如上Alex所说,更改.git/config文件的内容会有所帮助。我也遇到了同样的问题,我想这是因为我更改了我的Github用户名。无法使用更改更新本地文件。所以当你改变你的用户名时,你可能会考虑跑步
Git远程添加原点your_ssh_link_from_github
我希望这对你有所帮助;)
eval "$(ssh-agent -s)"
这是我自己的回购——应该有足够的使用权。对于其他回购,我能够拉和推没有问题。通过重新启动ssh-agent解决了这个问题。我用macos。
我在一台MAC上遇到了同样的问题,试图从我以前连接到的一个私人回购中提取。
我通过在回购url中包含我的用户名来解决这个问题:
git remote set-url origin https://<YOUR_USER_NAME_HERE>@github.com/<YOUR_USER_NAME_HERE>/<REPO>.git
然后我从回购中提取了数据。
对于一个你想克隆的新回购:
git clone https://<YOUR_USER_NAME_HERE>@github.com/<YOUR_USER_NAME_HERE>/<REPO>.git
它会提示你输入那个账户的密码,然后你就可以去了。
Github于2021年8月13日删除了用户名和密码的使用。现在改用个人代币
要克服这一点,请使用create personal token生成个人令牌。并使用下面的代码片段来实现推送和克隆功能。
推动
git remote remove origin
git remote add origin https://[USER]:[TOKEN]@github.com/[USER]/[REPO]
git push
克隆
git clone https://[USER]:[TOKEN]@github.com/[USER]/[REPO]