4 Using application made for git
Several application are meant to deal with git commands without having to use the terminal. They usually do not deal with git annex commands, so only small files (< 50MB) can be pushed via their interface. If most of your files are below that limit, one can use these application for routine work, and use either the command line (with
gin update .) or the browser interface from time to time to upload big files.
Most of them have a way to push to external servers like GitHub, gitlab, or bitbucket. They are usually to ways to make this connection: via https or via ssh. The ssh version is more secure, but you need to set up keys for each computer you are using, and add these keys to the server. Gin can be used as a git server and usual git commands will work normally, but GIN has no https connection: one needs to use ssh. One finds easily walkthrough to set up ssh connections for different application. Some examples will be given in the next chapters.
In addition, you need to set some configuration for git to push to a git server. This is often best done via the command lines:
git config --global user.name "FIRST_NAME LAST_NAME" git config --global user.email "MY_NAME@example.com"
4.2 Git GUI
git gui command comes with the normal Git bundle. Git GUI can be used to visualize:
- modifications in the repository
- files in the staging area
- the commit message
4.3 Using Rstudio with GIN
Rstudio is a very nice application that was created to write and run R code. It now also has the possibilities to run python code and create reproducible reports in Rmarkdown (there are also specific tools to deal with citations in these reports). It also has git functionalities, allowing to
commit (save a new version of your repository locally),
pull(download changes existant on the server but absent of your local folder) and
push (save all new versions present locally to the server version).
You need first to make sure git is installed and found by Rstudio: go the menu
tools > global options > git browse to the git.exe if Rstudio did not find it automatically (a git.exe is installed together with the gin-cli, but you can also install another via https://git-scm.com/downloads. Find a walkthrough on how to set up ssh here: https://happygitwithr.com/ssh-keys.html. What you are asked to do on github will be done on GIN (https://gin.g-node.org/user/settings/ssh).
You can now download new repositories using
file > new project... >>version control >> git insert the ssh link you get on the gin repository page (for this repo
firstname.lastname@example.org:/larkumlab/Dealing_with_Gin.git) and decide the folder name and where to save it on your machine. I put all my repositories in a special
gin folder in my document folder, but this is up to you to organise your files.
You can then make changes, on the right part of the Rstudio window, you can access a
git tab, where changed files are listed. You can then use the buttons of the tab to commit changes, pull, or push commits to GIN. Git advices:
- make small commits
- give commits a meaningfull comment which will allow you to spot changes easily in the history tab
- if you are working on different machines, do not forget to pull changes when you start working, and push before you go.