|
| 1 | +--- |
| 2 | +title: "Lecture B: Using Kebnekaise for the Git course" |
| 3 | +tags: Lecture, Birgitte, day 1 |
| 4 | +description: "Git installation, use of Kebnekaise, etc" |
| 5 | +--- |
| 6 | + |
| 7 | +<!-- Lecture material made by Birgitte Brydsö for the version of the course that was given in fall 2020. Lecture was first given by Birgitte Brydsö in fall 2020. |
| 8 | +Minor modifications done for the fall 2021 and 2022 versions of the course. --> |
| 9 | + |
| 10 | +<!-- Slides: https://hackmd.io/@git-fall-2022/LB-kebnekaise#/ --> |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +# Connecting to Kebnekaise |
| 15 | + |
| 16 | +## ThinLinc |
| 17 | + |
| 18 | +For this course we recommend using ThinLinc, but if you have your own installation of another SSH client that you prefer, you are welcome to use that. We will be using the command line only. |
| 19 | + |
| 20 | +* Download the client from https://www.cendio.com/thinlinc/download and install it. |
| 21 | +* Start the client. Enter the name of the server: kebnekaise-tl.hpc2n.umu.se and then enter your own username. |
| 22 | +* Go to "Options" -> "Security". Check that authentication method is set to password. |
| 23 | +* Go to "Options" -> "Screen" and uncheck "Full screen mode". |
| 24 | +* Enter your HPC2N password. Click "Connect". |
| 25 | + |
| 26 | +More information here: <a href="https://docs.hpc2n.umu.se/tutorials/connections/#thinlinc" target="_blank">https://docs.hpc2n.umu.se/tutorials/connections/#thinlinc</a>. |
| 27 | + |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +## SSH |
| 32 | + |
| 33 | +If you prefer to login with a regular SSH client (i.e. PuTTY, Terminal, Linux terminal, etc.) then use the following as server: |
| 34 | + |
| 35 | +```bash |
| 36 | +kebnekaise.hpc2n.umu.se |
| 37 | +``` |
| 38 | + |
| 39 | +Example: logging in from a terminal: |
| 40 | + |
| 41 | +```bash |
| 42 | +ssh <HPC2N username>@kebnekaise.hpc2n.umu.se |
| 43 | +``` |
| 44 | + |
| 45 | +More information here: |
| 46 | + |
| 47 | +- <a href="https://docs.hpc2n.umu.se/tutorials/connections/#login__nodes" target="_blank">https://docs.hpc2n.umu.se/tutorials/connections/#login__nodes</a> |
| 48 | +- <a href="https://docs.hpc2n.umu.se/tutorials/connections/#connecting__from__windows" target="_blank">Connecting from Windows</a> |
| 49 | +- <a href="https://docs.hpc2n.umu.se/tutorials/connections/#connecting__from__macos" target="_blank">Connecting from macOS</a> |
| 50 | + |
| 51 | +--- |
| 52 | + |
| 53 | +## Open OnDemand |
| 54 | + |
| 55 | +If you prefer to use HPC2N's OpenOnDemand web service, then: |
| 56 | + |
| 57 | +- Go to <a href="https://portal.hpc2n.umu.se" target="_blank">https://portal.hpc2n.umu.se</a> |
| 58 | +- Login with your HPC2N username and password |
| 59 | +- Pick "Interactive Apps" -> "Kebnekaise desktop" |
| 60 | +- Fill in the information. Pick 1 regular core and however many hours you expect to use on the course. Launch |
| 61 | +- After you have logged in, start a terminal: "Applications" -> "System Tools" -> "MATE Terminal" |
| 62 | + |
| 63 | +More information here: <a href="https://docs.hpc2n.umu.se/tutorials/connections/#open__ondemand" target="_blank">https://docs.hpc2n.umu.se/tutorials/connections/#open__ondemand</a> |
| 64 | + |
| 65 | +--- |
| 66 | + |
| 67 | +## Setting up Git |
| 68 | + |
| 69 | +Git is already installed on Kebnekaise, but you need to set your name and email globals *unless you have already done this at some earlier time*. |
| 70 | + |
| 71 | +* Open a terminal. In ThinLinc: Go to the menu at the top. Click “Applications” → “System Tools” → “MATE Terminal”. |
| 72 | +* Set your global name: `$ git config --global user.name "Your Name"` |
| 73 | +* Set your global email: `$ git config --global user.email "yourname@example.com"` |
| 74 | + |
| 75 | +You may also want to set your editor. We recommend vim, but other options are nano and emacs. |
| 76 | + |
| 77 | +* `$ git config --global core.editor vim` |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +## Testing your configuration |
| 82 | + |
| 83 | +Create an example folder and cd into that, then create a file test.txt: |
| 84 | + |
| 85 | +```bash |
| 86 | +$ mkdir <mydir> |
| 87 | +$ cd <mydir> |
| 88 | +$ touch test.txt |
| 89 | +``` |
| 90 | + |
| 91 | +Now initialize a repository and add the new file: |
| 92 | + |
| 93 | +```bash |
| 94 | +$ git init |
| 95 | +$ git add test.txt |
| 96 | +``` |
| 97 | + |
| 98 | +Now *commit* the change. The editor which you configured earlier should open. Add an example commit message: |
| 99 | + |
| 100 | +```bash |
| 101 | +$ git commit test.txt |
| 102 | +``` |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## Testing your configuration - continued |
| 107 | + |
| 108 | +Now let us look at the log: |
| 109 | + |
| 110 | +```bash |
| 111 | +$ git log |
| 112 | +``` |
| 113 | + |
| 114 | +When you do `git log`, you should see something like: |
| 115 | + |
| 116 | +```bash |
| 117 | +commit ff8b6f699d98c72d5cffc64d65a1c618b976b45a (HEAD -> master) |
| 118 | +Author: Birgitte Brydsö <bbrydsoe@cs.umu.se> |
| 119 | +Date: Thu Sep 17 13:53:59 2020 +0200 |
| 120 | + |
| 121 | + Test of git |
| 122 | +``` |
| 123 | + |
| 124 | +but with name, email and commit message different. |
| 125 | + |
| 126 | +If that is the case, your Git should be configured correctly. |
| 127 | + |
| 128 | +--- |
| 129 | + |
| 130 | +## Download the course materials |
| 131 | + |
| 132 | +For the individual hands-on part of the course, we have created some course materials which you will download from either the course website, the course GitHub, or the "important information" page. |
| 133 | + |
| 134 | +* Course website: https://www.hpc2n.umu.se/events/courses/2022/introduction-to-git |
| 135 | +* Course GitHub: https://github.com/hpc2n/course-intro-git |
| 136 | + - Click the green button labeled "Code" to get links to clone or download the materials. |
| 137 | +* Download the material, then please go to the terminal window where you have downloaded and set up Git. |
| 138 | +* Change the directory to wherever you wish to have the course material. |
| 139 | +* Copy/transfer the tarball there (or download there directly with `wget <url-to-tarball>`) |
| 140 | +* Unpack with `tar zxvf <tarball>` |
| 141 | + |
| 142 | + |
0 commit comments