remotes_handouts.tex 3.96 KB
 Martijn Vermaat committed Oct 14, 2013 1 2 \documentclass{article}  Jeroen F.J. Laros committed Apr 24, 2016 3 \providecommand{\handoutsTitle}{Git and remote repositories}  Martijn Vermaat committed Oct 14, 2013 4   Jeroen F.J. Laros committed Apr 24, 2016 5 6 \usepackage{handouts} \input{../shared/shared}  Martijn Vermaat committed Oct 14, 2013 7   Jeroen F.J. Laros committed Apr 24, 2016 8 9 \begin{document} \makeHeader  Martijn Vermaat committed Oct 14, 2013 10   Jeroen F.J. Laros committed Apr 24, 2016 11 \subsubsection*{Some notes about using GitLab}  Martijn Vermaat committed Jun 20, 2014 12 13 14 15 16 17 18 Please take the following into account with respect to our GitLab server: \begin{itemize} \item You can login to GitLab using your LUMC account. \item If you don't have an LUMC account, ask us to create a GitLab account for you and select {\em Standard} instead of {\em LDAP} on the login page. \end{itemize}  Mihai committed Sep 05, 2017 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41  It is convenient to set up an ssh key on GitLab. Make one as follows (you can leave all fields blank): \begin{lstlisting} $ssh-keygen Enter file in which to save the key (/home//.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: \end{lstlisting} \medskip Open \url{https://git.lumc.nl} in your browser and log in. \medskip Click on your avatar (top-right corner), choose Settings'', and then go the SSH Keys'' page. \medskip Copy your ssh key, retrieved with the following \lstinline{cat} command, and paste it in the Key'' field: \begin{lstlisting}$ cat ~/.ssh/id_rsa.pub \end{lstlisting} \medskip Give your key a title (e.g., Course machine'') and press the Add key'' button.  Martijn Vermaat committed Jun 20, 2014 42 43 \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 44 \subsubsection*{Add your repository to GitLab}  Martijn Vermaat committed Dec 01, 2015 45 46 47 48 49 \begin{quote} (If you don't have a repository on your local machine from the previous practical, create one now with at least one commit.) \end{quote}  Martijn Vermaat committed Oct 14, 2013 50 51 52 Now you have a nice repository, of course you want to share it on GitLab. \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 53 Go to GitLab (\url{https://git.lumc.nl}) and create a new project (use the  Martijn Vermaat committed Dec 01, 2015 54 same name you used to store your repository locally).  Martijn Vermaat committed Oct 14, 2013 55 56  \begin{itemize}  Martijn Vermaat committed Oct 14, 2013 57  \item \emph{Question:} What is the repository URL for your new project?  Martijn Vermaat committed Oct 14, 2013 58 59 60 \end{itemize} \bigskip  Martijn Vermaat committed Jun 20, 2014 61 Add the GitLab repository as a remote to your local repository.  Martijn Vermaat committed Oct 14, 2013 62 63 \bigskip  Martijn Vermaat committed Dec 01, 2015 64 Push your commits to GitLab.  Martijn Vermaat committed Oct 14, 2013 65 66  \begin{itemize}  Martijn Vermaat committed Oct 14, 2013 67 68  \item \emph{Question:} Can you see your repository content in the GitLab web interface?  Martijn Vermaat committed Oct 14, 2013 69 \end{itemize}  Martijn Vermaat committed Jun 20, 2014 70 \bigskip  Martijn Vermaat committed Oct 14, 2013 71   Jeroen F.J. Laros committed Apr 24, 2016 72 73 \emph{Hint:} Use \lstinline{git push} once with the \lstinline{-u} flag so you can use the \lstinline{git push} / \lstinline{git pull} shortcuts.  Martijn Vermaat committed Oct 14, 2013 74 75 \bigskip  Jeroen F.J. Laros committed Apr 24, 2016 76 \subsubsection*{More synchronisation}  Martijn Vermaat committed Dec 01, 2015 77 78 Look for a way to edit a file directly from the GitLab web interface (in your browser) and do this at least once.  Martijn Vermaat committed Oct 14, 2013 79 80 \bigskip  Martijn Vermaat committed Dec 01, 2015 81 82 Update your local copy of the file with the change you just made (by fetching and merging).  Martijn Vermaat committed Oct 14, 2013 83 84 \bigskip  Martijn Vermaat committed Dec 01, 2015 85 86 87 Now make another commit locally and push it to the GitLab server. Verify that all these changes are now present both on your local machine and on the GitLab server.  Martijn Vermaat committed Oct 14, 2013 88   jkvis committed Nov 08, 2017 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 \subsubsection*{Collaboration} In this practical, you'll work with both your repository and with the repository your neighbour created during the previous practical. We'll refer to this repository as {\bf N}, and to your own repository from the previous practical as {\bf Y}. Note that by now both repositories should have a corresponding GitLab project (a remote repository). \bigskip Make sure that your GitLab project \textbf{Y} is private and add your colleague as a member to it as \textbf{Guest}. \bigskip Try to \textbf{clone} his or her repository to your local machine. Make sure to do this in a separate directory. \begin{itemize} \item \emph{Question:} Was the cloning successful? Try to identify why. \end{itemize} Change the role of your neighbour from \textbf{Guest} to \textbf{Developer} and try to \textbf{clone} his repository again once your neighbour made you a \textbf{Developer}. \bigskip Edit locally a file from your neighbour \textbf{N} directory, stage it, commit it, and try to \textbf{push}. \begin{itemize} \item \emph{Question:} Were you able to push? Try to identify why. \end{itemize} Change your neighbour's role in your GitLab project from \textbf{Developer} to \textbf{Master}. \bigskip After your neighbour upgraded your role to \textbf{Master} try to push again your changes to his GitLab repository. \medskip Inspect the commit graph on GitLab.  Martijn Vermaat committed Oct 14, 2013 122 \end{document}