diff --git a/git-tutorial.tex b/git-tutorial.tex index 00a3ecf9fb86e08bd879da523ec2a91286f62a47..991d2869f02744c0fafd0400643ea75f3b87937e 100644 --- a/git-tutorial.tex +++ b/git-tutorial.tex @@ -4,9 +4,9 @@ \usepackage{tikz} \usepackage{listings} -\title{Git Tutorial\\ \tiny{Version: 0.3}} +\title{Git Tutorial\\ \tiny{Version: 0.4}} \author{Anders Nilsson \\ - \texttt{andersn@control.lth.se}} + \texttt{anders.nilsson@control.lth.se}} \lstset{ frame=single, @@ -472,40 +472,64 @@ In general, Google is your friend, and there are literally hundreds (if not thousands) of freely available git references, Q\&A:s, and tutorials out there. -% \section{FRT090 Specifics} -% \label{sec:frt090} +\section{FRT090 Specifics} +\label{sec:frt090} -% Here follows some specific information for students involved in the -% project course FRT090. +Here follows some specific information for students involved in the +project course FRT090. -% \subsubsection*{Repositories} +\subsubsection*{Repositories} -% At the department we are running an instance of \emph{Gitlab} -% (\texttt{https://about.gitlab.com/}, a web-based system used for -% administering git repositories. We will set up - - -% We have set up master repositories for you to at the department. To -% create a local clone you write something similar to: -% \begin{lstlisting} -% andersn@stodola: git clone gitolite@git.control.lth.se:frt090-2013-grupp-A -% Cloning into 'frt090-2013-grupp-A'... -% warning: You appear to have cloned an empty repository. -% \end{lstlisting} -% Just replace ``A'' with your gruoup denomination. You should now have -% an empty (except for .git) directory called -% \verb|frt090-2013-grupp-A|. - -% \subsubsection*{ssh problems} - -% If you want to be able to use more than one user account, for example -% you want to access the master repository both from computers @control -% and from your private laptop, you should make sure to use the same ssh -% key pair on all user accounts. Otherwise you will not be allowed -% access. You do this by copying \emph{both}\footnote{Well, you only -% \emph{need} to copy the \emph{private} key, but it does not really -% make sense to not also bring with you the public part.} key files to -% the other user account you want to use. +At the department we are running an instance of \emph{Gitlab} +(\texttt{https://about.gitlab.com/}, a web-based system used for +administering git repositories. We have set up master repositories for +you to at the department. To create a local clone you write something +similar to: +\begin{lstlisting} +andersn@stodola: git clone git@gitlab.control.lth.se:FRT090-2016/group-A +Cloning into 'group-A'... +warning: You appear to have cloned an empty repository. +\end{lstlisting} +Just replace ``A'' with your group denomination. You should now have +an empty (except for .git) directory called +\verb|group-A|. + +\subsubsection*{Playground} + +We have a playground repository set up if you want to try using the +gitlab server. Go to +\texttt{https://gitlab.control.lth.se/FRT090-2016/playground} and play around +or follow instructions to make a local clone to play around with. + +\subsubsection*{Gitlab accounts} + +You create an account by going to +\texttt{https://gitlab.control.lth.se} and following instructions +there. You may also use an existing Google account of yours if you +would like to. + +\subsubsection*{ssh or https} + +When accessing repositories on the gitlab server you can choose +between two protocols/authentication mechanisms; \emph{ssh} or +\emph{https}. To use \emph{https} does not require any further setup, +but the drawback is that you will have to authenticate with your +gitlab username/password everytime to access the server (every +\emph{push} and \emph{pull}). Using \emph{ssh} is recommended, but +that requires you to generate (if not done already) ssh keys and +uploading to the gitlab server. Good instructions are available if you +go to SSH keys in your gitlab account settings. + +\subsubsection*{ssh problems} + +If you want to be able to use more than one user account, for example +you want to access the master repository both from computers @control +and from your private laptop, you should make sure to use the same ssh +key pair on all user accounts. Otherwise you will not be allowed +access. You do this by copying \emph{both}\footnote{Well, you only + \emph{need} to copy the \emph{private} key, but it does not really + make sense to not also bring with you the public part.} key files to +the other user account you want to use. diff --git a/handson.pdf b/handson.pdf index 56fe98382574d881f59456bb1293f3bd3241cb07..938f2fba51d0a30e54f88c7a94389aff53ce6ff8 100644 Binary files a/handson.pdf and b/handson.pdf differ diff --git a/handson.tex b/handson.tex index c2b7109d37372a9b176c2870e14c85fd71291c2c..cd43e67d6b7c35ce6ee7e79ed10e70aca6f656e0 100644 --- a/handson.tex +++ b/handson.tex @@ -4,7 +4,7 @@ \usepackage{tikz} \usepackage{listings} -\title{Git Hands-On\\ \tiny{Version: 0.2.2}} +\title{Git Hands-On\\ \tiny{Version: 0.4}} \author{Anders Nilsson \\ \texttt{andersn@control.lth.se}} @@ -45,24 +45,27 @@ 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 +authorized\_keys id\_rsa known\_hosts +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. +You most probably don't have all the files I have, the important ones +to look for are the ones starting with 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: +To generate a key pair just run the following (press \emph{enter} a few times): \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): +andersn@heisenberg:/local/home/andersn\$ ssh-keygen -t rsa +Generating public/private rsa key pair. +Enter file in which to save the key (/local/home/andersn/.ssh/id_rsa): 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. +Your identification has been saved in id_rsa. +Your public key has been saved in id_rsa.pub. The key fingerprint is: SHA256:/TKfNkR7SEED5SRe2dH6GdECF6J7sFBUar+i4t5cN0A andersn@heisenberg The key's randomart image is: -+---[DSA 1024]----+ ++---[RSA 1024]----+ | .==X+++.| | o Bo+o.o| | . E .. o.| @@ -74,12 +77,12 @@ The key's randomart image is: | oo.+ .o. | +----[SHA256]-----+ \end{lstlisting} -\emph{Important!} When it asks for a passphrase, just press <enter>. +\emph{Important!} When it asks for a passphrase, just press \emph{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. +key id\_rsa.pub and click to add the key. % When you have signed in, tell me which project group you belong to. @@ -92,7 +95,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-2015/playground.git +git clone ssh://git@gitlab.control.lth.se:/FRT090-2016/playground.git cd playground \end{lstlisting} @@ -153,9 +156,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-2015/playground.git +To git@gitlab.control.lth.se:frt090-2016/playground.git ! [rejected] master -> master (fetch first) -error: failed to push some refs to 'git@gitlab.control.lth.se:frt090-2015/playground.git' +error: failed to push some refs to 'git@gitlab.control.lth.se:frt090-2016/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 @@ -173,7 +176,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-2015/playground +From gitlab.control.lth.se:frt090-2016/playground eb02c3c..0bf182c master -> origin/master Auto-merging Readme CONFLICT (content): Merge conflict in Readme