GitHub在默认情况下是不显示仓库大小的,那如果我们要怎样才能查看一个仓库的大小?这里介绍几种方法,需要注意的是这里要区分公开仓库和私有仓库。


目录

一、GitHub自带查看仓库大小的功能(public、private)

二、利用GitHub提供的API查看(public)

三、利用浏览器插件:Enhanced GitHub(public、private)

注意:私有仓库需要添加Token

补充:该插件的另一个很棒的功能就是很简单就能下载一个文件(暂时不支持下载文件夹)


一、GitHub自带查看仓库大小的功能(public、private)

因为这是自带功能,所以公开仓库和私有仓库都可以查看大小。

(以下内容转自:https://blog.csdn.net/i042416/article/details/86666843)

其实github上提供了非常方便的工具供我们查看。

登录github网页首页,选择自己账户的settings:

点击repository:

这里就有每个repository对应的存储空间大小:

二、利用GitHub提供的API查看(public)

只要访问指定网址,即可参看仓库大小,;所以只能访问公开仓库的信息。

语法:https://api.github.com/repos/user/repo ,访问后得到一个包含仓库信息的json数据。

如,我的第一个仓库:https://api.github.com/repos/yansheng836/hello-world

json数据如下:我们可以看到内容很丰富,其中的size就是仓库大小,单位是kb,其他内容有兴趣也可以了解下。

{"id": 159042524,"node_id": "MDEwOlJlcG9zaXRvcnkxNTkwNDI1MjQ=","name": "hello-world","full_name": "yansheng836/hello-world","private": false,"owner": {"login": "yansheng836","id": 45334066,"node_id": "MDQ6VXNlcjQ1MzM0MDY2","avatar_url": "https://avatars0.githubusercontent.com/u/45334066?v=4","gravatar_id": "","url": "https://api.github.com/users/yansheng836","html_url": "https://github.com/yansheng836","followers_url": "https://api.github.com/users/yansheng836/followers","following_url": "https://api.github.com/users/yansheng836/following{/other_user}","gists_url": "https://api.github.com/users/yansheng836/gists{/gist_id}","starred_url": "https://api.github.com/users/yansheng836/starred{/owner}{/repo}","subscriptions_url": "https://api.github.com/users/yansheng836/subscriptions","organizations_url": "https://api.github.com/users/yansheng836/orgs","repos_url": "https://api.github.com/users/yansheng836/repos","events_url": "https://api.github.com/users/yansheng836/events{/privacy}","received_events_url": "https://api.github.com/users/yansheng836/received_events","type": "User","site_admin": false},"html_url": "https://github.com/yansheng836/hello-world","description": ":smiley:My first repository. ","fork": false,"url": "https://api.github.com/repos/yansheng836/hello-world","forks_url": "https://api.github.com/repos/yansheng836/hello-world/forks","keys_url": "https://api.github.com/repos/yansheng836/hello-world/keys{/key_id}","collaborators_url": "https://api.github.com/repos/yansheng836/hello-world/collaborators{/collaborator}","teams_url": "https://api.github.com/repos/yansheng836/hello-world/teams","hooks_url": "https://api.github.com/repos/yansheng836/hello-world/hooks","issue_events_url": "https://api.github.com/repos/yansheng836/hello-world/issues/events{/number}","events_url": "https://api.github.com/repos/yansheng836/hello-world/events","assignees_url": "https://api.github.com/repos/yansheng836/hello-world/assignees{/user}","branches_url": "https://api.github.com/repos/yansheng836/hello-world/branches{/branch}","tags_url": "https://api.github.com/repos/yansheng836/hello-world/tags","blobs_url": "https://api.github.com/repos/yansheng836/hello-world/git/blobs{/sha}","git_tags_url": "https://api.github.com/repos/yansheng836/hello-world/git/tags{/sha}","git_refs_url": "https://api.github.com/repos/yansheng836/hello-world/git/refs{/sha}","trees_url": "https://api.github.com/repos/yansheng836/hello-world/git/trees{/sha}","statuses_url": "https://api.github.com/repos/yansheng836/hello-world/statuses/{sha}","languages_url": "https://api.github.com/repos/yansheng836/hello-world/languages","stargazers_url": "https://api.github.com/repos/yansheng836/hello-world/stargazers","contributors_url": "https://api.github.com/repos/yansheng836/hello-world/contributors","subscribers_url": "https://api.github.com/repos/yansheng836/hello-world/subscribers","subscription_url": "https://api.github.com/repos/yansheng836/hello-world/subscription","commits_url": "https://api.github.com/repos/yansheng836/hello-world/commits{/sha}","git_commits_url": "https://api.github.com/repos/yansheng836/hello-world/git/commits{/sha}","comments_url": "https://api.github.com/repos/yansheng836/hello-world/comments{/number}","issue_comment_url": "https://api.github.com/repos/yansheng836/hello-world/issues/comments{/number}","contents_url": "https://api.github.com/repos/yansheng836/hello-world/contents/{+path}","compare_url": "https://api.github.com/repos/yansheng836/hello-world/compare/{base}...{head}","merges_url": "https://api.github.com/repos/yansheng836/hello-world/merges","archive_url": "https://api.github.com/repos/yansheng836/hello-world/{archive_format}{/ref}","downloads_url": "https://api.github.com/repos/yansheng836/hello-world/downloads","issues_url": "https://api.github.com/repos/yansheng836/hello-world/issues{/number}","pulls_url": "https://api.github.com/repos/yansheng836/hello-world/pulls{/number}","milestones_url": "https://api.github.com/repos/yansheng836/hello-world/milestones{/number}","notifications_url": "https://api.github.com/repos/yansheng836/hello-world/notifications{?since,all,participating}","labels_url": "https://api.github.com/repos/yansheng836/hello-world/labels{/name}","releases_url": "https://api.github.com/repos/yansheng836/hello-world/releases{/id}","deployments_url": "https://api.github.com/repos/yansheng836/hello-world/deployments","created_at": "2018-11-25T14:52:04Z","updated_at": "2019-09-22T12:27:48Z","pushed_at": "2019-09-07T05:34:18Z","git_url": "git://github.com/yansheng836/hello-world.git","ssh_url": "git@github.com:yansheng836/hello-world.git","clone_url": "https://github.com/yansheng836/hello-world.git","svn_url": "https://github.com/yansheng836/hello-world","homepage": "https://yansheng836.github.io/hello-world/","size": 157,"stargazers_count": 0,"watchers_count": 0,"language": "C++","has_issues": true,"has_projects": true,"has_downloads": true,"has_wiki": true,"has_pages": true,"forks_count": 0,"mirror_url": null,"archived": false,"disabled": false,"open_issues_count": 0,"license": {"key": "mit","name": "MIT License","spdx_id": "MIT","url": "https://api.github.com/licenses/mit","node_id": "MDc6TGljZW5zZTEz"},"forks": 0,"open_issues": 0,"watchers": 0,"default_branch": "master","network_count": 0,"subscribers_count": 1
}

三、利用浏览器插件:Enhanced GitHub(public、private)

该插件在GitHub上开源:https://github.com/softvar/enhanced-github

Google商店网址:https://chrome.google.com/webstore/detail/enhanced-github/anlikcnbgdeidpacdbdljnabclhahhmd

下面是官方介绍:

概述


显示仓库大小,每个文件的大小,下载链接和复制文件内容的选项,在GitHub网站顶部提供有用功能的扩展。

特征

1.显示仓库规模。
2.显示每个活动分支中的每个文件大小(不适用于文件夹/符号链接)
3.显示每个文件的下载链接(不适用于文件夹/符号链接)
4.直接将文件内容复制到剪贴板(对于markdown文件不起作用)
5.在查看文件内容的同时下载文件。
7.即将推出...请在https://github.com/softvar/enhanced-github/issues上打开一个问题以提出建议

注意:从v1.0.0开始-由于GitHub已停止直接下载文件,因此在按Alt / Cmd(对于Mac)/ Ctrl(对于Windows)时单击下载图标/按钮。

它是开源的-根据MIT许可证 https://github.com/softvar/enhanced-github

注意:私有仓库需要添加Token

该插件适用于公开和私有仓库,但是私有仓库需要添加token,不然因为权限不够,会访问不了。

添加token步骤:(详情可见:https://github.com/softvar/enhanced-github#github-api-rate-limiting)

1. 先到 https://github.com/settings/tokens ,点击“Generate new token”,范围勾选repo就可以了(如下),拉到最下面,点击“Generatetoken”申请一个token。

2. 复制token,然后(右键)点击该插件,选择“选项”,跳转后,等一会儿(10s左右),会弹出如下弹窗,将复制的token填进去,然后去访问一个自己的私有仓库就可以显示大小。

补充:该插件的另一个很棒的功能就是很简单就能下载一个文件(暂时不支持下载文件夹)

查看GitHub仓库大小的几种方法相关推荐

  1. 计算机怎么看显卡内存容量,Win10系统显卡显存大小怎样查看?Win10查看显存大小的两种方法...

    对于十分关心电脑配置的用户而言,查看电脑显卡显存大小是一件非常必要的事情.那么,Win10系统电脑该怎样查看显卡显存大小呢?虽然现在有很多软件都可以直接查看,但是不使用软件查看才是真正的好方法.下面, ...

  2. 查看MySQL数据库大小的几种方法

    1.进入information_schema 数据库(存放了其他的数据库的信息) use information_schema; mysql> use information_schema Re ...

  3. hpux 下查看内存的的大小的几种方法:

    hpux 下查看内存的的大小的几种方法: # /opt/ignite/binpa/print_manifest|grep Memory NOTE: Could not read the /etc/re ...

  4. linux查看进程占用的内存大小,查看进程占用内存大小的几种方法,占用内存几种方法...

    查看进程占用内存大小的几种方法,占用内存几种方法 1. pmap -x pid 2. ps -aux | grep 进程名 ps -e -o 'pid,comm,args,pcpu,rsz,vsz,s ...

  5. 计算机配置高低怎么看,怎么查看电脑配置?(查看电脑配置高低的三种方法!)...

    电脑配置的高低直接影响着使用电脑时候的体验度,要是配置过低,电脑用起来就会很卡,稍微打开大一点的程序或者多开几个网页就卡死,非常不好用,那么,怎么查看电脑配置呢?电脑配置多高才合适呢?下面来告诉你. ...

  6. 查看计算机.net环境版本,windows7系统查看NET Framework版本的两种方法

    现在,很多用户都会在电脑中安装NET Framework,因为一些程序需要NET Framework才能运行.那么,如果想要查看我们计算机中的 NET Framework版本,该如何操作呢?接下来,就 ...

  7. 增加表空间大小的四种方法

    增加表空间大小的四种方法 Meathod1:给表空间增加数据文件 ALTER TABLESPACE app_data ADD DATAFILE 'D:\ORACLE\PRODUCT\10.2.0\OR ...

  8. 查看笔记本电池健康度的两种方法和电池报告解析

    查看笔记本电池健康度的两种方法和电池报告解析 概述 1. 通过CMD命令查看笔记本电脑电池的健康度 1.1 "WIn+R",输入 CMD 1.2 在 CMD 中输入以下命令 ==* ...

  9. 字体大小的设置_老年人用智能手机,怎样更改字体大小?3种方法,手把手教您学会...

    分享生活小妙招,共享科技新生活!大家好,欢迎来到今天的知识分享!我是你们的好朋友小俊! 我们的老年朋友在使用手机时候都会觉得字体太小,导致使用起来非常不方便,那么今天我就教大家三种方法来设置字体大小, ...

  10. 怎么看计算机版本号,如何查看电脑windows版本号(查看电脑版本信息的11种方法)...

    你知道你使用的是哪个版本的Windows吗?这个问题的答案不是太复杂,但是,这是你需要回答的问题,以便针对你遇到的问题获得相应的技术支持. 一.通过查看登录屏幕知道使用的Windows版本 通常可以查 ...

最新文章

  1. Zepto.js库touch模块代码解析
  2. Py之cx_Freeze:Python库之cx_Freeze库(程序打包)简介、安装、使用方法详细攻略—案例之实现机器人在线24小时智能翻译
  3. 思而后言:用点赞数据来帮助对话生成模型
  4. Batch Normalization原理及pytorch的nn.BatchNorm2d函数
  5. 使用CLONE TABLE方式实现同region不同可用区的MaxCompute
  6. linux ubuntu软件中心,安装Lubuntu 软件中心
  7. 深度学习:波士顿房价预测
  8. python数据结构-列表-1
  9. 苹果被拒:4.Guideline 2.3.3 - Performance - Accurate Metadata
  10. Linux ALSA声卡驱动之二:声卡的创建
  11. 咪咕音乐HTML代码,python3爬取咪咕音乐榜信息(附源代码)
  12. 【原创】2021-2000上市公司重污染企业数据、上市公司重污染行业数据(常用变量均包括,可直接用)
  13. am3352 安装ssl
  14. Codeforces Round #506 (Div. 3)题解
  15. origin做双Y轴折线图的具体步骤
  16. sql是什么mysql是什么_sql是什么意思
  17. Idea主菜单不见了(File,View等工具栏隐藏了)
  18. Springboot整合SpringSecurity 04-启用登出logout功能
  19. java处理图片与base64编码互相转换
  20. R语言使用na.omit函数删除矩阵matrix数据中的缺失值(NA值)

热门文章

  1. npm 如何处理依赖与依赖冲突
  2. Web 漏洞训练平台学习笔记(webgoat juice shop)
  3. 英雄连的制作公司THQ历史
  4. python计算成绩差_关于使用Python——写成绩计算
  5. HHKB键盘使用说明书
  6. python 制作工资条
  7. Linux应用编程之时间编程
  8. IDEA直接查找快捷键来修改这个快捷键
  9. 硬盘录像机数据恢复方法
  10. 华为HCNA乱学Round 9:VRRP