System Administration

Adding a new git repository to my gitosis setup.

Quick cheatsheet for adding a new git repository under my setup (with gitosis)

The main reason that I have this note is because this is much simpler than I expect - I always think that it will be much more complex, and so start researching how everything fits together :-)


1: Add the project / repo to gitosis:

1.1: Edit the ~/src/configs/gitosis-admin/gitosis.conf:

[group data]
members = wkumari wkumari@eric
writable = data

1.2: Commit and push the change:

root@ron[0]:~/src/configs/gitosis-admin# git commit -a -m "Added the 'data' repository"
[master 9072fe9] Added the 'data' repository
1 file changed, 4 insertions(+)

root@ron[0]:~/src/configs/gitosis-admin# git push
Counting objects: 3, done.
Delta compression using up to 24 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 331 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
7320023..9072fe9 master -> master

2: Create and push the repo:

wkumari@ron[0]:~$ mkdir data
wkumari@ron[0]:~$ cd data/
wkumari@ron[0]:~/data$ ls
wkumari@ron[0]:~/data$ touch testfile
wkumari@ron[0]:~/data$ git init
Initialized empty Git repository in /home/wkumari/data/.git/
wkumari@ron[0]:~/data$ git add testfile
wkumari@ron[0]:~/data$ git commit -a -m "Add a test file"
wkumari@ron[0]:~/data$ git remote add origin
wkumari@ron[0]:~/data$ git push --set-upstream origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 214 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
* [new branch] master -> master
Branch master set up to track remote branch master from origin.
wkumari@ron[0]:~/data$ git push
Everything up-to-date

3: Profit!!!

Fixing the new Ubuntu grub / VGA console.

I use Ubuntu on various servers; unfortunatly Ubuntu is increasingly aimed more at a consumer desktop audience, and it tries to do things like boot with a pretty, high resolution spash screen, hide the grub screen, etc. This does not work at all well for a server - it fails with the monitors on datacenter crash carts, it fails with many KVMs, DRACs, etc. 

In order to get back to a more sane console, edit /etc/defaults/grub and make the beginning look like: 

GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="nosplash xvga=640x480"

Performing remote Wireshark and tcpdump over SSH

tcpdump can be configured to write its capture to standard out, and Wireshark can read from standard in. SSH allows you to remote exec a command, and have it stream the output back.

This allows one to perform a remote Wireshark capture quickly and easily - one of the nice uses for this is to perform captures from a Ubiquti router. For exmaple:

ssh 'sudo tcpdump -f -i eth1 -w - port 53' | /Applications/Local/  -k -i -

This ssh's to my home router, and starts tcpdump listening on interface eth1. It writes the output to STDOUT ('-w -') and only captures port 53. This then streams to wireshark on my local machine (-k is "start capturing immediately" and -i is interface -- in this case, STDIN (-)).



Sync'ing a git / GitHub fork.

I need to do this fairly frequently, and for some reason I can never remember the steps, so I'm writing it down!

This isn't news, it is lifted from the GitHub Configuring a remote for a fork and Syncing a fork pages.

$ git remote add upstream

$ git fetch upstream
$ git checkout master
$ git merge upstream/master

Make your edits, etc. Push (this will push to your fork), make pull-request. Next time you need to sync the orogin, start at the 'git fetch upstream' step.


Adding a new git repo to my system

I don't add new repos very often, so this is my cheatsheet....

On ron: edit src/configs/gitosis-admin/gitosis.conf

Commit and push these changes.

Then simply git checkout the new repo name. I generally name repos something like code_python, so checkout and then rename the directory. Done!


To add an existing git repo: 
git remote add origin