diff --git a/handson.pdf b/handson.pdf index b7fc980108d04fe027da02707f45a711ac0e4676..c537ae2df684003539eb1e72f1f6abcfdbda7efc 100644 Binary files a/handson.pdf and b/handson.pdf differ diff --git a/handson.tex b/handson.tex index 270ea8f0affc562200d2bb2bc4e0c8f5e87d3d46..7f445cfa0b1b121c772bcf6c4b460c5b107a4a17 100644 --- a/handson.tex +++ b/handson.tex @@ -4,7 +4,7 @@ \usepackage{tikz} \usepackage{listings} -\title{Git Hands-On\\ \tiny{Version: 0.1}} +\title{Git Hands-On\\ \tiny{Version: 0.2.2}} \author{Anders Nilsson \\ \texttt{andersn@control.lth.se}} @@ -20,7 +20,7 @@ \section{Introduction} \label{sec:intro} -It is assumed tha you have working installation of git on your +It is assumed that you have working installation of git on your computer. This hands-on tutorial will straight through use text mode git as run in a terminal window. Feel free to use a graphical client of your choice instead if that makes you feel better. @@ -33,6 +33,48 @@ Begin by opening a web browser and go to \texttt{http://gitlab.control.lth.se} and sign up for a new account, or authenticate using a google ID if you prefer that. +Authentication when accessing repositories on the gitlab server is +handled using SSH keys, we should therefore generate a key pair (if +you don't already have keys) and upload the public key to the gitlab +server. First, check for possibly existing keys: +\begin{lstlisting} +andersn@heisenberg:/local/home/andersn\$ ls ~/.ssh/ +authorized\_keys id\_dsa.keystore id\_rsa known\_hosts +id\_dsa id\_dsa.pub id\_rsa.pub +\end{lstlisting} +You most probably don't have all the files I have, the important ones to look for are the ones starting with id\_dsa or id\_rsa. If you have at least one of these pairs, just skip to the next step and upload the key to the server. + +To generate a key pair just run the following: +\begin{lstlisting} +andersn@heisenberg:/local/home/andersn\$ ssh-keygen -t dsa +Generating public/private dsa key pair. +Enter file in which to save the key (/local/home/andersn/.ssh/id_dsa): +Enter passphrase (empty for no passphrase): +Enter same passphrase again: +Your identification has been saved in id_dsa. +Your public key has been saved in id_dsa.pub. +The key fingerprint is: +SHA256:/TKfNkR7SEED5SRe2dH6GdECF6J7sFBUar+i4t5cN0A andersn@heisenberg +The key's randomart image is: ++---[DSA 1024]----+ +| .==X+++.| +| o Bo+o.o| +| . E .. o.| +| = =o .. | +| S =ooo .o| +| ++....| +| =.=. | +| .o o *oo | +| oo.+ .o. | ++----[SHA256]-----+ +\end{lstlisting} +\emph{Important!} When it asks for a passphrase, just press <enter>. + +Ok, now we have SSH keys so let's then upload the public key to the +server. On the gitlab webpage in your browser, find 'Profile Settings' +, 'SSH Keys', 'Add SSH Key'. Copy-Paste the contents of your public +key id\_dsa.pub and click to add the key. + % When you have signed in, tell me which project group you belong to. % When get an acknowledgement on group memebership, @@ -44,7 +86,7 @@ git config --global user.email "andersn@control.lth.se" \end{lstlisting} Then let's clone the playground repository: \begin{lstlisting} -git clone ssh://git@gitlab.control.lth.se:/frt090-2014/playground.git +git clone ssh://git@gitlab.control.lth.se:/FRT090-2015/playground.git cd playground \end{lstlisting} @@ -95,7 +137,7 @@ Delta compression using up to 8 threads. Compressing objects: 100\% (2/2), done. Writing objects: 100\% (3/3), 306 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) -To ssh://git@gitlab.control.lth.se:/frt090-2014/playground.git +To ssh://git@gitlab.control.lth.se:/FRT090-2015/playground.git 8a8ad08..eb02c3c master -> master \end{lstlisting} @@ -105,9 +147,9 @@ If the previous push command went as shown, you happened to be the first in the group to perform a push. Instead you might see something similar to \begin{lstlisting} andersn@fiol:../andersn/work/playground\$ git push -To git@gitlab.control.lth.se:frt090-2014/playground.git +To git@gitlab.control.lth.se:frt090-2015/playground.git ! [rejected] master -> master (fetch first) -error: failed to push some refs to 'git@gitlab.control.lth.se:frt090-2014/playground.git' +error: failed to push some refs to 'git@gitlab.control.lth.se:frt090-2015/playground.git' hint: Updates were rejected because the remote contains work that you do hint: not have locally. This is usually caused by another repository pushing hint: to the same ref. You may want to first integrate the remote changes @@ -125,7 +167,7 @@ remote: Counting objects: 5, done. remote: Compressing objects: 100\% (2/2), done. remote: Total 3 (delta 1), reused 0 (delta 0) Unpacking objects: 100\% (3/3), done. -From gitlab.control.lth.se:frt090-2014/playground +From gitlab.control.lth.se:frt090-2015/playground eb02c3c..0bf182c master -> origin/master Auto-merging Readme CONFLICT (content): Merge conflict in Readme