Unfortunately, the standard way to install git-lfs doesn’t work on RPi2. But there is simple workaround:
# install go
sudo apt-get install golang
# you may want to grab a coffee at this stage... 😉
# get git-lfs from github
go get github.com/github/git-lfs
cp gocode/bin/git-lfs /usr/bin
The github repository of #NGSchool website has grown to over 5GB. I wanted to reduce the size & simplify this repository, but this task turned out to quite complicated. Instead, I have decided to leave current repo as is (and probably removed it soon) and start new repo for existing version. I could do that, as I don’t care about version earlier than the one I’m currently using. This is short how-to:
- Push all changes and remove .git folder
git push origin master
rm -rI .git
- Rename existing repo
Settings > Repository name > RENAME
- Start new repository using old repo name
Don’t need to create any files as all already exists.
- Init your local repo and add new remote
git remote add origin firstname.lastname@example.org:USER/REPO
- Commit changes and push
git add --all . && git commit -m "fresh" && git push origin master
Doing so, my new repo size is below 1GB, which is much better compared to 5GB previously.
Git is great, there is no doubt about that. Being able to revert any changes and recover lost data is simply priceless. But recently, I have started to be concerned about the size of some of my repositories. Some, especially those containing changing binary files, were really large!!!
You can check the size of your repository by simple command:
git count-objects -vH
Here, git Large File Storage (LSF) comes into action. Below, I’ll describe how to install and mark large binary files, so they are not uploaded as a whole, but only relevant chunks of changed binary file is uploaded.
- Installation of git-lfs
# add packagecloud repo
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
# install git-lsf
sudo apt-get install git-lfs
# end enable it
git lfs install
- Marking and commiting binary file
# mark large binary file
git lfs track some.file
# add, commit & push changes
git add some.file
git commit -m "some.file as LSF"
git push origin master
Today I’ve faced problem with syncing two github repositories. Yes, I know, I shouldn’t keep two, but sometimes it’s difficult to avoid. Anyway, the problem is super easy to solve. It’s enough to edit `.git/config` by adding new remote:
url = email@example.com:user1/repo1.git
url = firstname.lastname@example.org:user2/repo2.git
Of course, more than two repos can be added. Then, after next push all repositories will be synced.
git push Origin master
Counting objects: 61, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (61/61), done.
Writing objects: 100% (61/61), 5.73 KiB | 0 bytes/s, done.
Total 61 (delta 41), reused 0 (delta 0)
8b97528..8aed8c2 master -> master
Inspired by ruiabreu.