Skip to content

Cloning Github repository

Michael T. Judge edited this page Aug 10, 2023 · 27 revisions

How to clone SAFER as a repository

Intended for those who don't usually work with Github

There are two ways you could do this:

The SAFER way 😇

1) Install [Github Desktop](https://desktop.github.com/)
Set up Github through desktop. I have a `Github` directory in in my `Documents` folder, and usually mount my repositories there. 

2) In the Github Desktop App, you should see something like this in the top left corner:
  <img width="278" alt="clone_1" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/ccb8dff5-8585-4843-9e5c-1f3f8f1f3d76">

3) Click the Add button there

  <img width="444" alt="clone_3" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/58289a09-c4b9-4cad-be25-99d8c77f441b">

4) Click 'Clone Repository'. You'll see this pop up:

  <img width="493" alt="clone_4" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/203b282d-9c7e-4694-8fcb-29c91b913b82">

select URL, then you'll see this:

  <img width="491" alt="clone_5" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/271dca8c-e3ea-40e0-a6e4-5f20d84c8b31">

Use the 'Choose' option to set your mounting folder to `Documents/Github`, or wherever you want to mount your repos on your machine. Then, 
enter the URL of SAFER (`https://github.com/EBI-Metabolights/SAFER`) into the field that says `URL or username/repository`, and you should 
see the `Local Path` field update. This means that Github Desktop will create a folder called `SAFER` in that location (e.g. 
`Documents/Github` in my case). This is where all your other cloned repositories will live by default. In the `SAFER` folder is where all 
the code for the package will go:

  <img width="480" alt="clone_6" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/cd1bc676-a7dd-4ec7-9edd-462e2b75ce5a">

Click the `Clone` button, and you should see the following:

  <img width="1211" alt="clone_7" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/4539a2bf-e84d-46ec-a8ad-f09a8d1d7de0">

This means the files are being downloaded. Once that's done, you'll get this:

  <img width="1172" alt="clone_end" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/bcf78274-35de-4d56-bf51-7f57352d7bc9">

The cool thing is, now Github Desktop will now update all of the files in the `SAFER` folder with the most recent release version whenever 
you open the app and click the `Fetch origin` button. Sometimes it will say `Pull origin`. There are probably differences in what these 
mean, but either is fine for our purposes. 

Take note of where this repo is mounted. You can find this information by right-clicking the `Current Repository' button on the top left 
corner (where we started) and clicking `Reveal in Finder` (on a Mac):

  <img width="779" alt="clone_reveal_finder" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/a62c4811-f895-4e5d-8ec8-331429123549">
 
which will open a Finder window in that location. 
  <img width="725" alt="clone_reveal_2" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/8e0e8048-2763-4de4-9e68-97c95b28eeb3">

On a Mac, you can then use `Cmd-Option-C` to copy the filepath of the folder 

(e.g. /Users/mjudge/Documents/GitHub/SAFER in my case). This will be useful for pipeline setup later on, and we'll refer to it as path_to_SAFER_repo_clone

That's it! Feel free to get in touch if this doesn't work for you - and feel free to modify as you like, create forks, etc. if you want to develop off of what we've done.

Okay, now for the dirty way 😈 (seriously, not recommended, but if you can't be bothered with Github...)

Beware: you won't receive any updates to the code, and any changes you make are on you.

Go to the [SAFER Github page](https://github.com/EBI-Metabolights/SAFER).

Click the Green `Code` button, then select `Download ZIP`:

  <img width="1016" alt="image" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/3743ea56-c4e9-4b95-b7f2-df2389176b40">

(Move if you want) and Expand it locally:

  <img width="695" alt="image" src="https://github.com/EBI-Metabolights/SAFER/assets/15824301/738206c2-3c5b-4b42-b73a-fd155fccbd77">

Copy the file location and use that as `path_to_SAFER_repo_clone` in the [setup process](https://github.com/EBI-Metabolights/SAFER/wiki/Setup)

But, really: it's not the best option. 

Clone this wiki locally