derHugo
derHugo

Reputation: 90833

How to find out actually Size of all Github repositories of an organistation

We are moving our Github repositories to a local Server with GitLab-Server on it. And we will use a Jenkins-Server for building.

Before that we wanted to find out, how big the Harddrive has to be minimal on both machines.

-> GitServer will need diskspace for the repos
-> Jenkins-Server will need diskspace for the repos + space for building

Therefor: Is there a way to find out how many disk space all of our repositories have together - not only actual file size but really the size of the whole git repository?

I read about the API. But doing

curl -i -u <myUserName>  https://api.github.com/orgs/<organisationName>

I actually can receive metadata but it doesn't seem to give any information about actual used disk space:

HTTP/1.1 200 OK
Server: GitHub.com
Date: Fri, 09 Jun 2017 15:09:07 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 1463
Status: 200 OK
X-RateLimit-Limit: 5000
X-RateLimit-Remaining: 4980
X-RateLimit-Reset: 1497022865
Cache-Control: private, max-age=60, s-maxage=60
Vary: Accept, Authorization, Cookie, X-GitHub-OTP
ETag: "62fadd06b840f42f8bf9cb69450b9d1b"
Last-Modified: Tue, 30 May 2017 12:33:36 GMT
X-GitHub-Media-Type: github.v3; format=json
Access-Control-Expose-Headers: ETag, Link, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval
Access-Control-Allow-Origin: *
Content-Security-Policy: default-src 'none'
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-XSS-Protection: 1; mode=block
X-Runtime-rack: 0.068430
X-GitHub-Request-Id: XXXX:XXXX:XXXXXXX:XXXXXXX:XXXXXXX

{
  "login": "XXXXXXXX",
  "id": XXXXXXXXX,
  "url": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "repos_url": "https://api.github.com/orgs/XXXXXXX/repos",
  "events_url": "https://api.github.com/orgs/XXXXXX/events",
  "hooks_url": "https://api.github.com/orgs/XXXXXX/hooks",
  "issues_url": "https://api.github.com/orgs/XXXXXX/issues",
  "members_url": "https://api.github.com/orgs/XXXXXX/members{/member}",
  "public_members_url": "https://api.github.com/orgs/XXXXXX/public_members{/member}",
  "avatar_url": "https://avatars1.githubusercontent.com/XXXXXX",
  "description": "XXXXXX",
  "name": "XXXXXX",
  "company": null,
  "blog": "XXXXXX",
  "location": "XXXXXX",
  "email": "XXXXXXXXXXXXXXXXXXXX",
  "has_organization_projects": true,
  "has_repository_projects": true,
  "public_repos": 0,
  "public_gists": 0,
  "followers": 0,
  "following": 0,
  "html_url": "https://github.com/XXXXXXXXXXXXXX",
  "created_at": "2016-09-14T11:30:47Z",
  "updated_at": "2017-05-30T12:33:36Z",
  "type": "Organization",
  "total_private_repos": 62,
  "owned_private_repos": 62,
  "private_gists": null,
  "disk_usage": null,
  "collaborators": null,
  "billing_email": null,
  "plan": {
    "name": "team",
    "space": 976562499,
    "private_repos": 99999,
    "filled_seats": 15,
    "seats": 15
  },
  "default_repository_permission": null,
  "members_can_create_repositories": true
}

there is one tag space but it seems to be only the maximum space available not the used. And there is another tag disk_usage but it is null.

Upvotes: 0

Views: 406

Answers (2)

derHugo
derHugo

Reputation: 90833

I kind of solved it in the end using

git lfs clone --mirror RepoURL localRepoFolder
cd localRepoFolder
git-lfs fetch --all
du -s
#cleanup
cd ..
rm -rf localRepoFolder

for each repository in a loop and summed up all sizes

Upvotes: 0

mattbornski
mattbornski

Reputation: 12563

Perhaps git clone --bare them all and check size on disk?

Upvotes: 1

Related Questions