# Git usage in CMS open data environments

**URL:** <https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35>\
**Category:** Software tools\
**Created:** [9 July 2020 07:25 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35 "2020-07-09T07:25:27Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![kati](https://opendata-forum.cern.ch/letter_avatar_proxy/v4/letter/k/5f9b8f/32.png) [@kati](https://opendata-forum.cern.ch/u/kati)\
**Post date:** [9 July 2020 07:25 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/1 "2020-07-09T07:25:28Z")

</div>

Due to protocol changes w.r.t to the legacy environment, the git clone commands produce an error:

```
git clone https://github.com/cms-opendata-validation/2010-mu-mumonitor-dimuon Validation/Mu_Mumonitor_dimuon_2010
Cloning into 'Validation/Mu_Mumonitor_dimuon_2010'...
error: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version while accessing https://github.com/cms-opendata-validation/2010-mu-mumonitor-dimuon/info/refs?service=git-upload-pack
fatal: HTTP request failed

```

The CMS open data environments will soon be updated to fix this error. Meanwhile, there are two solutions:

You can use `git clone git` format, i.e.

`git clone git://github.com/cms-opendata-validation/2010-mu-mumonitor-dimuon Validation/Mu_Mumonitor_dimuon_2010`

in the CMS open data containers or in the `CMS Shell` in the VM image.

Alternatively, clone the repository normally with `git clone https...` in a more recent environment:

- if using containers, in your local area, which you [mount as a volume](https://awesome-workshop.github.io/intro-to-docker/04-file-io/index.html) to the container
- if using VM, in the terminal with a more recent OS, which opens from a terminal icon on the bottom of the desktop screen (remember that in the VM, building the CMSSW area and compiling must be done in the `CMS shell`)

---

<div class="post-metadata">

**Author:** ![mattbellis](https://opendata-forum.cern.ch/user_avatar/opendata-forum.cern.ch/mattbellis/32/8_2.png) [@mattbellis](https://opendata-forum.cern.ch/u/mattbellis)\
**Post date:** [25 July 2020 05:51 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/2 "2020-07-25T05:51:12Z")

</div>

In addition to the above, if you are using containers and you want to be able to access the ssh keys needed to clone repos, for example from Github, you’ll want to launch the container such that the keys are accessible from inside the container.

```auto
docker run --it -v ${HOME}/.ssh:/home/cmsusr/.ssh ...

```

As a more complete example, I run the following to start a CMSSW 5.3.32 container instance making sure that I a) can access my ssh keys and b) will have X11 forwarding enabled.

```auto
 docker run -it -v ${HOME}/.ssh:/home/cmsusr/.ssh --net=host --env="DISPLAY" --volume="$HOME/.Xauthority:/root/.Xauthority:rw" cmsopendata/cmssw_5_3_32 /bin/bash

```

---

<div class="post-metadata">

**Author:** ![SiewYan](https://opendata-forum.cern.ch/user_avatar/opendata-forum.cern.ch/siewyan/32/48_2.png) [@SiewYan](https://opendata-forum.cern.ch/u/SiewYan)\
**Post date:** [13 April 2022 07:23 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/3 "2022-04-13T07:23:19Z")

</div>

For those who are looking for the working syntex, you may use older version of git (\<2.0) to checkout:

```auto
git clone git@github.com:cms-opendata-validation/2010-mu-mumonitor-dimuon Validation/Mu_Mumonitor_dimuon_2010

```

---

<div class="post-metadata">

**Author:** ![jillziegler](https://opendata-forum.cern.ch/user_avatar/opendata-forum.cern.ch/jillziegler/32/55_2.png) [@jillziegler](https://opendata-forum.cern.ch/u/jillziegler)\
**Post date:** [12 July 2022 19:38 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/4 "2022-07-12T19:38:50Z")

</div>

I’ve tried both this and the solution in the reply by SiewYan and neither has worked for me.

When using this original fix, I am told I can’t connect to GitHub and that my connection has timed out.

When I use SiewYan’s suggestion, I am told I can’t read from the directory and may not have permission or the correct address.

(I would have given the precise output I’m getting, but it is read as including too many links for me to post.)

Is there a third possible solution or do I have some other problem?

---

<div class="post-metadata">

**Author:** ![kati](https://opendata-forum.cern.ch/letter_avatar_proxy/v4/letter/k/5f9b8f/32.png) [@kati](https://opendata-forum.cern.ch/u/kati)\
**Post date:** [12 July 2022 20:01 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/5 "2022-07-12T20:01:35Z")

</div>

Hi, thanks for reporting!

Can you confirm the container image you are using?

If you are using `cmsopendata/cmssw_5_3_32` [these instructions](https://cms-opendata-workshop.github.io/workshop2021-lesson-docker/03-docker-for-cms-opendata/index.html) should work.

Note that you should **not** submit `cmsenv` command in the container as it changes `git` back to older versions. The container environment is set up and ready to use at the start-up without additional commands.

Hope this help and if not, please list the exact command so that we can reproduce.

Best, Kati  
for the CMS open data team

---

<div class="post-metadata">

**Author:** ![jillziegler](https://opendata-forum.cern.ch/user_avatar/opendata-forum.cern.ch/jillziegler/32/55_2.png) [@jillziegler](https://opendata-forum.cern.ch/u/jillziegler)\
**Post date:** [12 July 2022 20:31 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/6 "2022-07-12T20:31:56Z")

</div>

Thanks for the reply!

I am using cmsopendata/cmssw\_5\_3\_32, but I had submitted the cmsenv command before I tried it.

Please forgive the question and my inexperience, but what is the best way of reversing the cmsenv command?

Thanks again!

~Jill Ziegler  
QuarkNet teacher  
University of Notre Dame QuarkNet Center and Hamilton High School West

---

<div class="post-metadata">

**Author:** ![kati](https://opendata-forum.cern.ch/letter_avatar_proxy/v4/letter/k/5f9b8f/32.png) [@kati](https://opendata-forum.cern.ch/u/kati)\
**Post date:** [12 July 2022 20:37 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/7 "2022-07-12T20:37:00Z")

</div>

I’m glad that helps! That’s a good question also for the experienced 😉 I believe the easiest thing is to exit from the container and start it again (`docker start -i <container-name>`)  
To see if it helps you can type `git --version` before exiting and again when you have started and if the output is different then you’re back to the correct environment.

Best, Kati

---

<div class="post-metadata">

**Author:** ![jillziegler](https://opendata-forum.cern.ch/user_avatar/opendata-forum.cern.ch/jillziegler/32/55_2.png) [@jillziegler](https://opendata-forum.cern.ch/u/jillziegler)\
**Post date:** [12 July 2022 22:00 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/8 "2022-07-12T22:00:38Z")

</div>

Does that apply to the VM? I tried it and it didn’t seem to work. I’m running v 1.7.something of git, apparently.

~Jill

---

<div class="post-metadata">

**Author:** ![kati](https://opendata-forum.cern.ch/letter_avatar_proxy/v4/letter/k/5f9b8f/32.png) [@kati](https://opendata-forum.cern.ch/u/kati)\
**Post date:** [13 July 2022 07:24 UTC](https://opendata-forum.cern.ch/t/git-usage-in-cms-open-data-environments/35/9 "2022-07-13T07:24:29Z")

</div>

If you are using the VM, then you should indeed submit `cmsenv` in the “CMS shell” once you’ve built your CMSSW area.  
But you will then use the other shell (“Outer shell”) for `git` as it has a different, more recent environment where you should be able to use the `git clone https://...` syntax.  
But do not submit `cmsenv` in the “Outer shell”, it will change the `git` version there.

Remember to do all compiling (`scram b`) in the “CMS shell”.

This is all due to the challenge of providing the correct environment for open data, but still trying to adapt to the changes in the surrounding world.

Best, Kati
