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

相关推荐
寻道码路1 小时前
【GitHub开源AI精选】WhisperX:70倍实时语音转录、革命性词级时间戳与多说话人分离技术
人工智能·开源·github
南宫码农3 小时前
苹果cms
github·电视盒子·源代码
CoderJia程序员甲4 小时前
GitHub 热榜项目 - 日榜(2026-02-04)
开源·大模型·llm·github·ai教程
该用户已存在(真)5 小时前
工程项目训练--病毒分析
github·课程设计
小灰灰搞电子7 小时前
github/gitee 操作命令详解
gitee·github
会写代码的饭桶9 小时前
【DevOps实战】使用 GitHub Actions 自动构建镜像并双推至 Docker Hub 和 GHCR
docker·自动化·github·devops
MicrosoftReactor9 小时前
技术速递|GitHub Copilot SDK 与云原生的完美融合
云原生·github·copilot
JiL 奥10 小时前
简易的 AWS SAM + GitHub Actions 项目
云计算·github·aws
潘晓可10 小时前
从自建Github实例迁移仓库到SaaS版Github
github
极客小云10 小时前
【基于AI的自动商品试用系统:不仅仅是虚拟试衣!】
javascript·python·django·flask·github·pyqt·fastapi