-
Notifications
You must be signed in to change notification settings - Fork 1
Chapter_4
Chris McIntosh edited this page Nov 21, 2019
·
2 revisions
-
bare repository refers to a repo without a working directory
- The repo on the collaboration server for instance
- Local Protocol
- Refers to a locally available filesystem
- Can be shared with an NFS mount for example
-
git clone <path/to/file>
Directly copies the files -
git clone file://<path/to/file>
Uses the network protocol (which is less efficient locally)- the
file://
method will strip extraneous files (such as after a migration)
- the
git remote add <local proj> <path/to/file>
- File based protocols are simple and use existing file permissions
- Often more difficult to share if you are not on the same network
- Often slower than an ssh based request
- Every user has full shell access to the directory so it is risky in that aspect
- HTTP Protocol
- Smart HTTP
- New since
1.6.6
- Similar to
SSH
orgit
protocols - Runs over standard HTTPS ports and uses standard auth
- Often the preferred protocol now since it is a single URL
- New since
- Dumb HTTP
- simple setup
- Shove the git repo under HTTP root and setup a
post-update
hook (which comes with your default install)
- Simple to use and doesn't require SSH keys (could be a con for advanced users)
- Can serve read-only over HTTPS
- Sometimes more tricky to setup than SSH
- Smart HTTP
- SSH Protocol
git clone ssh://<user>@<server>/<project>.git
- Easy to use if you are already using SSH and have it setup to the server
- Doesn't support anonymous access
- People must have ssh access to the machine
- Really? How does GitHub use SSH keys then? Surely I don't have ssh access
- Git Protocol
- Daemon listening on
9418
- No Auth
- Needs a
git-daemon-export-ok
file - extremely fast
- Often paired with SSH or HTTPS for pushing
- Daemon listening on
-
git clone --bare <project> <project>.git
Clones into a new bare repo (without the working directory) - Copy the new directory to your server
- At this point the SSH protocol is ready, if SSH is set up on the server
-
git init --bare --shared
sets up group write perms
- Skipping, this just goes over
ssh-keygen
- Skipping, this goes over saving public key's to the
.authorized_keys
folder as well as setting up SSH server
-
git daemon --reuseaddr --base-path=<path/to/repo> <path>/<to>/<repo>
-
--reuseaddr
allows server to restart without waiting for old connections to timeout -
--base-path
allows cloning without the pull path - Uses port
9418
so you may need to punch a hole in your firewall - Can use systemd to daemonize the above command
- In the valid repo's to get served you need to run
touch git-daemon-export-ok
to enable daemon access
-
- CGI script, so requires the use of some CGI server (Just apache?)
- Need to set up
.htpasswd
in the git repo- Not the only way to have Apache authenticate though
- GitWeb is a basic CGI Script that visualizes your repo
-
git instaweb --httpd=webrick
sets up a local webserver and sends your browser to it - For a more permanent solution you'll need to set up the CGI script to be hosted like the Smart HTTP protocol
- Skipping... You can find an ami from Bitnami and run through the setup if you really want
- Useful Commands
git clone --bare <project> <project>.git
git init --bare --shared