解决github无法克隆私有仓库,Repository not found问题(2024最新)

一、背景

这个问题出现,是你用了其他主机设备,需要重新clone私有库时,发现一直报找不到仓库,如下报错:

powershell 复制代码
remote: Repository not found.

二、解决方法

(1)账号密码方式(已不支持,不推荐)

之前有个解决方法,通过HTTP协议克隆时,加上账号密码,如:

powershell 复制代码
git clone https://用户名:密码@github.com/用户名/仓库.git

但是这个方法已经不行了,GitHub已经在2021年8月13号开始不支持这种方式clone仓库。你就会见到下面这个报错:

powershell 复制代码
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.

(2)Token方式(推荐!!!)

所以,可以通过Token的方式进行克隆私有仓库。

powershell 复制代码
git clone http://token名字:token的值@github.com/用户名/仓库.git

创建access token的方法:

进入GitHub的Settings > Developer Settings > Personal Access Token > Generate New Token > 勾选需要的功能, 正常选上repo就够了. > 点击 Generate token 就行了

另外,先立即复制保存你的Token,因为关闭之后,就无法在查看Token。


总结

出现这个问题,主要是刚买了个99的阿里的服务器,然后在服务器拉取私有仓库,本地开发私有仓库时发生。 如果你需要学习服务器相关知识,整一个2核2G的一年才99的服务器也不错。平时没有优惠,有需要的学习党或者前端工作党,赶紧冲起来优惠地址可以参考这个传送大门

相关推荐
MarkHD11 小时前
GitHub Copilot实战教程:AI编程助手的完整使用指南
github·copilot·ai编程
大写-凌祁15 小时前
零基础入门深度学习:从理论到实战,GitHub+开源资源全指南(2025最新版)
人工智能·深度学习·开源·github
悟乙己15 小时前
Github | MoneyPrinterTurbo:自动化视频内容生成系统
自动化·github·音视频
雁于飞17 小时前
vscode中使用git、githup的基操
笔记·git·vscode·学习·elasticsearch·gitee·github
icebreaker21 小时前
tailwindcss 究竟比 unocss 快多少?
前端·css·github
Giant1001 天前
小白也能看懂的 Git 命令手册:从配置到提交,一步到位
github
ruanCat1 天前
使用 vite 的 base 命令行参数来解决项目部署在 github page 的路径问题
前端·github
FreeBuf_1 天前
Salesloft Drift网络攻击事件溯源:GitHub账户失陷与OAuth令牌窃取
安全·github
第七种黄昏1 天前
GitHub 项目提交完整流程(含常见问题与解决办法)
github
确定过眼神!1 天前
GitHub提交到公共项目流程
github·changeset