diff options
Diffstat (limited to 'doc/tips/centralized_git_repository_tutorial/on_GitLab.mdwn')
-rw-r--r-- | doc/tips/centralized_git_repository_tutorial/on_GitLab.mdwn | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/doc/tips/centralized_git_repository_tutorial/on_GitLab.mdwn b/doc/tips/centralized_git_repository_tutorial/on_GitLab.mdwn new file mode 100644 index 000000000..71814a99a --- /dev/null +++ b/doc/tips/centralized_git_repository_tutorial/on_GitLab.mdwn @@ -0,0 +1,76 @@ +This tutorial shows how to set up a centralized repository hosted on +GitLab. + +Since GitLab has [added support for git-annex on their servers](https://about.gitlab.com/2015/02/17/gitlab-annex-solves-the-problem-of-versioning-large-binaries-with-git/), +you can store your large files on GitLab, quite easily. + +Note that as I'm writing this, GitLab is providing this service for free, +and I don't know how much data they're willing to host for free. + +## create the repository + +Go to <https://gitlab.com/> and sign up for an account, and create the +repository there. Take note of the SSH clone url for the repository, which +will be something like `git@gitlab.com:yourlogin/annex.git`. + +We want to clone this locally, on your laptop. (If the clone fails, you +need to generate a ssh key and add it to GitLab.) + + # git clone git@gitlab.com:yourlogin/annex.git + # cd annex + +Tell git-annex to use the repository, and describe where this clone is +located: + + # git annex init 'my laptop' + init my laptop ok + +Add some files, obtained however. + + # git annex add *.mp4 + add Haskell_Amuse_Bouche-b9OVqxmI.mp4 (checksum) ok + (Recording state in git...) + # git commit -m "added a video. I have not watched it yet but it sounds interesting" + +Feel free to rename the files, etc, using normal git commands: + + # git mv Haskell_Amuse_Bouche-b9OVqxmI.mp4 Haskell_Amuse_Bouche.mp4 + # git commit -m 'better filenames' + +## push to GitLab + +Now make a first push to the GitLab repository. +As well as pushing the master branch, remember to push the git-annex +branch, which is used to track the file contents. + + # git push origin master git-annex + To git@gitlab.com:yourlogin/annex.git + * [new branch] master -> master + * [new branch] git-annex -> git-annex + +That push went fast, because it didn't upload the large file contents yet. + +So, to finish up, tell git-annex to sync all the data in the repository +to GitLab: + + # git annex sync --content + ... + +## make more checkouts + +So far you have a central repository on GitLab, and a checkout on a laptop. +Let's make another checkout elsewhere. Clone the central repository as before. +(If the clone fails, you need to generate a ssh key and add it to GitLab.) + + elsewhere# git clone git@gitlab.com:yourlogin/annex.git + elsewhere# cd annex + +Notice that your clone does not have the contents of any of the files yet. +If you run `ls`, you'll see broken symlinks. It's easy to download them from +GitLab either by running `git annex sync --content`, or by asking +git-annex to download individual files: + + # git annex get Haskell_Amuse_Bouche.mp4 + get Haskell_Amuse_Bouche.mp4 (from origin...) + 12877824 2% 255.11kB/s 00:00 + ok |