解决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的服务器也不错。平时没有优惠,有需要的学习党或者前端工作党,赶紧冲起来优惠地址可以参考这个传送大门

相关推荐
桌面运维家5 小时前
中小学IDV云桌面vDisk挂载部署方案
github
MXN_小南学前端6 小时前
Vue3 + Spring Boot 工单系统实战:用户反馈和客服处理的完整闭环(提供gitHub仓库地址)
前端·javascript·spring boot·后端·开源·github
lentoo-7 小时前
GitHub 暂停了 Copilot 付费注册
github·copilot
一颗青果7 小时前
Cookie 与 Session 超详细讲解
服务器·前端·github
skywalk81639 小时前
为aicomm项目添加CI/CD 配置 让github帮我们自动测试
ci/cd·github
Yunzenn9 小时前
零基础复现Claude Code(五):终端篇——赋予执行命令的超能力
面试·github
Yunzenn9 小时前
零基础复现Claude Code(四):双手篇——赋予读写文件的能力
开源·github
CoderJia程序员甲10 小时前
GitHub 热榜项目 - 日榜(2026-04-23)
人工智能·ai·大模型·github·ai教程
叹一曲当时只道是寻常10 小时前
Reference 工具安装与使用教程:一条命令管理 Git 仓库引用与知识沉淀
人工智能·git·ai·开源·github
不会编程的-程序猿10 小时前
PyCharm 直接把本地项目上传到 GitHub
ide·pycharm·github