Results 1 to 5 of 5

Thread: [GitHub] - Free local hard disk space ?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    [GitHub] - Free local hard disk space ?

    Hi
    I would like to ask a question about GitHub
    (It's not the right place, but maybe Tanner or someone else can answer)

    Problem:
    Whenever you "update" github repositories, the amount of used space on your local hard disk increases.
    If, like me, you update many files, and / or very heavy files, the amount of space used by the hard disk really grows a lot.
    I do not care to keep track of the whole history of the repository,
    The last version is enough for me. (especially regarding the "Site" https://miorsoft.github.io/Site/index.html)
    I need to free space on the local hard disk.
    And I suppose you can do this by removing all the history of the repository.
    Here, how is it done?

    I could try this way, but first I would like to have some more certainty.

    -Create a local copy of the Repo.
    -Remove all the Github data from this copy (".git" folder)
    - Delete the old copy and rename the new one with the name of the Repo.
    - Go to the browser and permanently delete the Repo.
    - Upload to the Repo disk copy using the same name (of the deleted one)

    Can someone give me useful and detailed information / links on how to proceed?

    Thanks

  2. #2
    PowerPoster
    Join Date
    Jun 2013
    Posts
    7,253

    Re: [GitHub] - Free local hard disk space ?

    There's a lot of different options (as soon as you'll use git on the commandline) -
    though all of them "will delete some stuff" - so it's best to make a copy of your local repo first...

    One relatively "clean" way to keep all the history on GitHub - and work only with a small(er) local repo,
    would apparently be "shallow clones" - though the link below will address also other options, with regards
    to "how to handle big git-repos": https://www.atlassian.com/blog/git/h...positories-git

    I've so far only used the "default-options of my local GIT-GUI" when working against my vbWidgets-GitHub-Repo,
    and thus have no experience (cannot assist) with any of these "special options", mentioned in the link...

    Olaf

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: [GitHub] - Free local hard disk space ?

    Thanks!

    BTW I'm not interested even on maintain remote history.

    I try the command suggested in the link

    (Before I Renamed local folder to Repo_ORIG so I can restore it)

    Code:
    git clone --depth [depth] [remote-url]
    Original folder 761 MB
    Cloned 186 MB

    Nice result.

    But now, how can I push this new shrinked folder to remote Github Repository ?

    (Tried with Github-Desktop but the (cloned) repository gives error: "We could not figure out the state of comparison graph" -"An error occured while trying to calculate the graph state of the repository")

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: [GitHub] - Free local hard disk space ?

    I got a reply on Github community. so I show it here:

    from mpboom

    You could just do it like this (WARNING - this deletes your entire Git history, on ALL branches!):

    Code:
    cd <repository root>
    rm -R ./.git
    git init
    git remote add origin <repo location on GH>
    git push origin master —force
    It deletes the Git repo locally, then creates a new one, then adds your repo on GH as a remote and force pushes it to GH, overwriting any changes there.

    - Mark

    GithubCommunity

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2010
    Location
    Italy
    Posts
    678

    Re: [GitHub] - Free local hard disk space ?

    So the complete command sequence should be this:
    WARNING - this deletes your entire Git history, on ALL branches!

    Code:
    cd <repository root>
    rm -R ./.git
    git init
    git remote add origin <repo location on GH>
    
    git add --all :/
    git commit -am 'message'
    
    git push origin master —force
    maybe there is a smarter mode using
    Code:
    git clone --depth [depth] [remote-url]
    That can keep desired history depth.

    ... I'll investigate....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width