# cbx33/gitt

### Subversion checkout URL

You can clone with HTTPS or Subversion.

 049362f Added base chap7 cbx33 authored Apr 23, 2011 1 % chap7.tex - Week 7 2 \cleardoublepage 3 %\phantomsection 4 \chapter{Week 7} 5 07e06cc Some changes to chap7, research and a spelling fix on chap6 cbx33 authored Apr 25, 2011 6 How to collab, pushing, rebasing, merging, patches 7 049362f Added base chap7 cbx33 authored Apr 23, 2011 8 \section{Day 1 - Networking with a difference''} 9 \subsection{Pushing across a LAN} 10 5864209 Started talking about SSH and protocols cbx33 authored Apr 29, 2011 11 Now we have a complete copy of our repository in another location. At the moment we have created this clone on the same machine that our original is. This isn't really a very good idea for backup purposes. Git supplies several means with which to talk to a remote machine, but by far the most common of these is to utilise the SSH protocol. SSH is a secure, encrypted way to communicate with a remote repository. Which is a must for pushing to an important repository that people are going to pull information from. 12 13 If we assume that for a moment that our user \emph{john} has now moved to another machine and now wishes to clone a repository that he had on his original machine to this new one. The commands are identical to that which we used before. We are going to assume that \emph{john} already has SSH access to the machine. In this way, we can issue the commands as follows. 14 15 \begin{Verbatim}[frame=leftline,framerule=1mm,fontsize=\relsize{-3}] 16 john@akira:~$git clone ssh://john@satsuki/home/john/coderepo coderepo-ne 17 Initialized empty Git repository in /home/john/coderepo-ne/.git/ 18 john@akira's password: 19 remote: Counting objects: 53, done. 20 remote: Compressing objects: 100% (36/36), done. 21 Receiving objects: 100% (53/53), 4.84 KiB, done. 22 Resolving deltas: 100% (10/10), done. 23 remote: Total 53 (delta 10), reused 0 (delta 0) 24 john@akira:~$ 25 \end{Verbatim} 26 27 Now we have done exactly as before and cloned our repository to a local folder called \texttt{coderepo-ne} from the remote url \texttt{ssh://john@satsuki/home/john/coderepo}. Notice the use of \texttt{ssh://} to denote the specification of the SSH protocol. We have also put the users name in the url of the remote path. If the SSH server was running on a different port to usual, that is, on a port other than 22, we could have also added a port number preceeded by a colon after the hostname. 049362f Added base chap7 cbx33 authored Apr 23, 2011 28 5864209 Started talking about SSH and protocols cbx33 authored Apr 29, 2011 29 SSH isn't the only protocol that Git can use. We have already looked at two; local and SSH. In fact, Git supports a further two protocols and these are HTTP/S and Git's own GIT protocol. We are going to take a quick look at the Git protocol next, before moving on to HTTP/S. 30 31 \subsection{The Git Protocol} 32 The Git protocol is the fastest transfer protocol out there for Git repositories. This should come as no surprise, since it was developed exclusively for use within a Git environment. It does however have a relatively large drawback. The drawback is that it provides absolutely no authentication. For this reason, enabling the Git protocol on a repository and running the server backend, (described later), will allow anyone who can talk to the servers port complete read access to the repository. 33 34 If you are serving a large repository on the Internet for example, this could actually be rather beneficial and will allow you to serve pulls quickly and efficiently. However, though it is possible to enable \emph{pushing} using the Git protocol, the lack of security would mean that anyone who could see the server and connect to the port, usually 9418, could make changes to the repository. This is usually entirely undesirable and as such people will often couple a read-only GIT protocol with a writable SSH protocol for the developers that need push access. 35 36 \subsection{The HTTP/S Protocol} 37 38 39 The Git 40 41 \section{Day 2 - Now let's work together''} 42 \subsection{Pure collaboration} 049362f Added base chap7 cbx33 authored Apr 23, 2011 43