美文网首页GitHub上有趣的资源
在克隆前查看github项目大小

在克隆前查看github项目大小

作者: Zeabin | 来源:发表于2018-12-18 23:09 被阅读8次

有次在克隆github项目的时候突然想知道项目有多大,发现好像没有什么直接的方式的可以看到,搜索了一番主要有两种方式:安装浏览器插件,使用GitHub API

  1. 安装浏览器插件
  1. 使用GitHub API

直接在浏览器地址栏输入https://api.github.com/repos/organization/repository
其中organization替换为项目的所有者(组织),repository替换为项目的名称`
返回的页面是描述这个项目的JSON数据,其中的size指的就是项目的大小,单位为kB(千字节)

git组织的git项目:https://api.github.com/repos/git/git
北京大学的gStore项目:https://api.github.com/repos/pkumod/gStore

{
  "id": 26917250,
  "node_id": "MDEwOlJlcG9zaXRvcnkyNjkxNzI1MA==",
  "name": "gStore",
  "full_name": "pkumod/gStore",
  "private": false,
  "owner": {
    "login": "pkumod",
    "id": 42833321,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjQyODMzMzIx",
    "avatar_url": "https://avatars2.githubusercontent.com/u/42833321?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/pkumod",
    "html_url": "https://github.com/pkumod",
    "followers_url": "https://api.github.com/users/pkumod/followers",
    "following_url": "https://api.github.com/users/pkumod/following{/other_user}",
    "gists_url": "https://api.github.com/users/pkumod/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/pkumod/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/pkumod/subscriptions",
    "organizations_url": "https://api.github.com/users/pkumod/orgs",
    "repos_url": "https://api.github.com/users/pkumod/repos",
    "events_url": "https://api.github.com/users/pkumod/events{/privacy}",
    "received_events_url": "https://api.github.com/users/pkumod/received_events",
    "type": "Organization",
    "site_admin": false
  },
  "html_url": "https://github.com/pkumod/gStore",
  "description": "gStore - a graph based RDF triple store.",
  "fork": false,
  "url": "https://api.github.com/repos/pkumod/gStore",
  "forks_url": "https://api.github.com/repos/pkumod/gStore/forks",
  "keys_url": "https://api.github.com/repos/pkumod/gStore/keys{/key_id}",
  "collaborators_url": "https://api.github.com/repos/pkumod/gStore/collaborators{/collaborator}",
  "teams_url": "https://api.github.com/repos/pkumod/gStore/teams",
  "hooks_url": "https://api.github.com/repos/pkumod/gStore/hooks",
  "issue_events_url": "https://api.github.com/repos/pkumod/gStore/issues/events{/number}",
  "events_url": "https://api.github.com/repos/pkumod/gStore/events",
  "assignees_url": "https://api.github.com/repos/pkumod/gStore/assignees{/user}",
  "branches_url": "https://api.github.com/repos/pkumod/gStore/branches{/branch}",
  "tags_url": "https://api.github.com/repos/pkumod/gStore/tags",
  "blobs_url": "https://api.github.com/repos/pkumod/gStore/git/blobs{/sha}",
  "git_tags_url": "https://api.github.com/repos/pkumod/gStore/git/tags{/sha}",
  "git_refs_url": "https://api.github.com/repos/pkumod/gStore/git/refs{/sha}",
  "trees_url": "https://api.github.com/repos/pkumod/gStore/git/trees{/sha}",
  "statuses_url": "https://api.github.com/repos/pkumod/gStore/statuses/{sha}",
  "languages_url": "https://api.github.com/repos/pkumod/gStore/languages",
  "stargazers_url": "https://api.github.com/repos/pkumod/gStore/stargazers",
  "contributors_url": "https://api.github.com/repos/pkumod/gStore/contributors",
  "subscribers_url": "https://api.github.com/repos/pkumod/gStore/subscribers",
  "subscription_url": "https://api.github.com/repos/pkumod/gStore/subscription",
  "commits_url": "https://api.github.com/repos/pkumod/gStore/commits{/sha}",
  "git_commits_url": "https://api.github.com/repos/pkumod/gStore/git/commits{/sha}",
  "comments_url": "https://api.github.com/repos/pkumod/gStore/comments{/number}",
  "issue_comment_url": "https://api.github.com/repos/pkumod/gStore/issues/comments{/number}",
  "contents_url": "https://api.github.com/repos/pkumod/gStore/contents/{+path}",
  "compare_url": "https://api.github.com/repos/pkumod/gStore/compare/{base}...{head}",
  "merges_url": "https://api.github.com/repos/pkumod/gStore/merges",
  "archive_url": "https://api.github.com/repos/pkumod/gStore/{archive_format}{/ref}",
  "downloads_url": "https://api.github.com/repos/pkumod/gStore/downloads",
  "issues_url": "https://api.github.com/repos/pkumod/gStore/issues{/number}",
  "pulls_url": "https://api.github.com/repos/pkumod/gStore/pulls{/number}",
  "milestones_url": "https://api.github.com/repos/pkumod/gStore/milestones{/number}",
  "notifications_url": "https://api.github.com/repos/pkumod/gStore/notifications{?since,all,participating}",
  "labels_url": "https://api.github.com/repos/pkumod/gStore/labels{/name}",
  "releases_url": "https://api.github.com/repos/pkumod/gStore/releases{/id}",
  "deployments_url": "https://api.github.com/repos/pkumod/gStore/deployments",
  "created_at": "2014-11-20T14:59:01Z",
  "updated_at": "2018-12-18T01:14:43Z",
  "pushed_at": "2018-12-15T11:12:42Z",
  "git_url": "git://github.com/pkumod/gStore.git",
  "ssh_url": "git@github.com:pkumod/gStore.git",
  "clone_url": "https://github.com/pkumod/gStore.git",
  "svn_url": "https://github.com/pkumod/gStore",
  "homepage": "http://www.icst.pku.edu.cn/intro/leizou/projects/gStore.htm",
  "size": 56946,
  "stargazers_count": 164,
  "watchers_count": 164,
  "language": "C++",
  "has_issues": true,
  "has_projects": true,
  "has_downloads": true,
  "has_wiki": true,
  "has_pages": false,
  "forks_count": 90,
  "mirror_url": null,
  "archived": false,
  "open_issues_count": 0,
  "license": {
    "key": "bsd-3-clause",
    "name": "BSD 3-Clause \"New\" or \"Revised\" License",
    "spdx_id": "BSD-3-Clause",
    "url": "https://api.github.com/licenses/bsd-3-clause",
    "node_id": "MDc6TGljZW5zZTU="
  },
  "forks": 90,
  "open_issues": 0,
  "watchers": 164,
  "default_branch": "master",
  "organization": {
    "login": "pkumod",
    "id": 42833321,
    "node_id": "MDEyOk9yZ2FuaXphdGlvbjQyODMzMzIx",
    "avatar_url": "https://avatars2.githubusercontent.com/u/42833321?v=4",
    "gravatar_id": "",
    "url": "https://api.github.com/users/pkumod",
    "html_url": "https://github.com/pkumod",
    "followers_url": "https://api.github.com/users/pkumod/followers",
    "following_url": "https://api.github.com/users/pkumod/following{/other_user}",
    "gists_url": "https://api.github.com/users/pkumod/gists{/gist_id}",
    "starred_url": "https://api.github.com/users/pkumod/starred{/owner}{/repo}",
    "subscriptions_url": "https://api.github.com/users/pkumod/subscriptions",
    "organizations_url": "https://api.github.com/users/pkumod/orgs",
    "repos_url": "https://api.github.com/users/pkumod/repos",
    "events_url": "https://api.github.com/users/pkumod/events{/privacy}",
    "received_events_url": "https://api.github.com/users/pkumod/received_events",
    "type": "Organization",
    "site_admin": false
  },
  "network_count": 90,
  "subscribers_count": 34
}

总结
使用浏览器插件更直观更方便,只需要安装插件
使用GitHub API的方式更简单,有人可能不喜欢安装那么多插件,比如我,不过需要稍微记一下格式

参考:
在克隆它之前看到github仓库的大小?- codeday.me
see the size of a github repo before cloning it - StackOverflow

相关文章

  • 在克隆前查看github项目大小

    有次在克隆github项目的时候突然想知道项目有多大,发现好像没有什么直接的方式的可以看到,搜索了一番主要有两种方...

  • git/GitHub的一些基础操作

    github.com基本功能 仓库Repository 收藏Star收藏他人的项目方便下次查看 克隆Fork克隆他...

  • github克隆项目

    How to use First, clone the repo. Second, delete the old ...

  • git推送代码到github

    前提 注册github账号,在github上创建一个属于自己的项目。创建项目: 从github远程仓库克隆项目到本...

  • git以及github使用教程

    创建秘钥 github添加远程公钥 克隆远程仓库 clone 项目 用于把GitHub上的项目克隆到本地变为本地仓...

  • 如何查看github项目有多大小

    可以通过GitHub API[http://developer.github.com/v3/repos/]访问这些...

  • VS Code在线阅读 GitHub 代码

    平时在github中查看项目文件,总是要各种点,或者克隆到本地再打开,今天看到这个在线阅读的小技巧,就记录分享一下...

  • git的那些事儿

    ·项目在多次提交之后会慢慢的变大,怎么办? 查看文件夹下面所有文件或者文件夹的大小: du -ah 这是出现克隆失...

  • Failed connect to github.com:443

    在github上克隆项目时报错,在2020.10.14测试,按此方法解决! 1、ip138.com查询github...

  • git常用操作

    打tag 克隆仓库到本地 克隆仓库分支到本地 查看git所处分支 查看git远程仓库地址 在已有的项目中新增.gi...

网友评论

    本文标题:在克隆前查看github项目大小

    本文链接:https://www.haomeiwen.com/subject/fpvrkqtx.html