Git repo

From Finninday
Jump to: navigation, search

Instructions for hosting git on a raspberry pi.

on ferret, clone the documentation repo

rday@ferret:~$ mkdir doc
rday@ferret:~$ cd doc
rday@ferret:~/doc$ ls
rday@ferret:~/doc$ git clone ssh://weasel/home/rday/doc/ .
Cloning into '.'...
rday@weasel's password: 
remote: Counting objects: 2425, done.
remote: Compressing objects: 100% (2355/2355), done.
remote: Total 2425 (delta 1087), reused 0 (delta 0)
Receiving objects: 100% (2425/2425), 172.89 MiB | 6.16 MiB/s, done.
Resolving deltas: 100% (1087/1087), done.
Checking connectivity... done

But that doesn't quite work since pushing from ferret will make the weasel working branch and index out of sync. What I really need is a bare repo that is centrally accessible.

setup bare repo on raspi

rday@raspbmc:/drobo2/git$ mkdir doc                                   
rday@raspbmc:/drobo2/git$ cd doc
rday@raspbmc:/drobo2/git/doc$ git clone --bare ssh://weasel/home/rday/doc/ .
Cloning into bare repository '.'...
Could not create directory '/home/rday/.ssh'.
The authenticity of host 'weasel (216.99.216.99)' can't be established.
RSA key fingerprint is be:7f:1e:a6:2a:e3:01:1e:5f:25:2d:9c:6a:0f:ef:10.
Are you sure you want to continue connecting (yes/no)? yes
Failed to add the host to the list of known hosts (/home/rday/.ssh/known_hosts).
rday@weasel's password: 
remote: Counting objects: 2425, done.
remote: Compressing objects: 100% (2355/2355), done.
fatal: The remote end hung up unexpectedlyB | 76 KiB/s      
fatal: early EOF
fatal: index-pack failed
rday@raspbmc:/drobo2/git/doc$ ls
Killed
rday@raspbmc:/drobo2/git/doc$ ls     
rday@raspbmc:/drobo2/git/doc$ git clone --bare ssh://weasel/home/rday/doc/ .
Segmentation fault
rday@raspbmc:/drobo2/git/doc$ df
-bash: fork: Cannot allocate memory

Out of memory

OK, forget the raspberry pi

set up bare repo using weasel

rday@weasel:/drobo2/git/doc$ git clone --bare ssh://weasel/home/rday/doc/ .
Cloning into bare repository '.'...
The authenticity of host 'weasel (216.99.216.99)' can't be established.
RSA key fingerprint is be:7f:1e:a6:2a:e3:01:1e:5f:25:2d:9c:6a:0f:ef:10.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'weasel,216.99.216.99' (RSA) to the list of known hosts.
Enter passphrase for key '/home/rday/.ssh/id_rsa': 
remote: Counting objects: 2425, done.
remote: Compressing objects: 100% (2355/2355), done.
remote: Total 2425 (delta 1088), reused 0 (delta 0)
Receiving objects: 100% (2425/2425), 172.89 MiB | 6.56 MiB/s, done.
Resolving deltas: 100% (1088/1088), done.
Checking connectivity... done

clone to servo

[rday@servo git]$ mkdir doc
[rday@servo git]$ cd doc
[rday@servo doc]$ git clone ssh://weasel/drobo2/git/doc/ .
Cloning into '.'...
remote: Counting objects: 2425, done.
remote: Compressing objects: 100% (1267/1267), done.
remote: Total 2425 (delta 1088), reused 2425 (delta 1088)
Receiving objects: 100% (2425/2425), 172.89 MiB | 1.28 MiB/s, done.
Resolving deltas: 100% (1088/1088), done.
Checking connectivity... done.

use the clone on servo

commit a change

[rday@servo doc]$ git commit -a -m "trivial change"
[master d412a53] trivial change
 1 file changed, 1 deletion(-)

push that change to the bare repo

[rday@servo doc]$ git push
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 295 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To ssh://weasel/drobo2/git/doc/
   382307f..d412a53  master -> master
[rday@servo doc]$ git remote show
origin

put checkbook data in a git repo

background

  • checkbook data originally in /home/rday/.moneydance
  • want to store that in a bare repo on weasel:/drobo2/git/moneydance and have it be available from different workstations

procedure

create an empty bare repo on server

rday@weasel:/drobo2/git$ mkdir moneydance.git
rday@weasel:/drobo2/git$ cd moneydance.git
rday@weasel:/drobo2/git/moneydance.git$ git --bare init
Initialized empty Git repository in /drobo2/git/moneydance.git/

make the checkbook data a repo on workstation

rday@ferret:~/.moneydance$ git init
Initialized empty Git repository in /home/rday/.moneydance/.git/
rday@ferret:~/.moneydance$ git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#	Documents/
#	archive/
#	config.dict
#	errlog.txt
#	fmodules/
#	stockExchanges.dict
#	tmp/
nothing added to commit but untracked files present (use "git add" to track)
rday@ferret:~/.moneydance$ git remote add origin ssh://weasel/drobo2/git/moneydance.git
rday@ferret:~/.moneydance$ git remote -v
origin	ssh://weasel/drobo2/git/moneydance.git (fetch)
origin	ssh://weasel/drobo2/git/moneydance.git (push)

rday@ferret:~/.moneydance$ git add *

rday@ferret:~/.moneydance$ git commit -m "initial commit"
[master (root-commit) a7a78f6] initial commit
 62 files changed, 492647 insertions(+)
...

push from workstation to server

rday@ferret:~/.moneydance$ git push origin
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

rday@weasel's password: 
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'ssh://weasel/drobo2/git/moneydance.git'

rday@ferret:~/.moneydance$ git config --global push.default simple
rday@ferret:~/.moneydance$ git status
# On branch master
nothing to commit, working directory clean
rday@ferret:~/.moneydance$ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

rday@ferret:~/.moneydance$ git push --set-upstream origin master
rday@weasel's password: 
Counting objects: 73, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (63/63), done.
Writing objects: 100% (73/73), 5.63 MiB | 868.00 KiB/s, done.
Total 73 (delta 11), reused 0 (delta 0)
To ssh://weasel/drobo2/git/moneydance.git
 * [new branch]      master -> master
Branch master set up to track remote branch master from origin.

pull from a different workstation

  • move aside existing checkbook directory
[rday@servo ~]$ mv .moneydance .moneydance-old
[rday@servo ~]$ mkdir .moneydance
[rday@servo ~]$ cd .moneydance
[rday@servo .moneydance]$ git clone ssh://weasel/drobo2/git/moneydance.git .
Cloning into '.'...
remote: Counting objects: 73, done.
remote: Compressing objects: 100% (63/63), done.
remote: Total 73 (delta 11), reused 0 (delta 0)
Receiving objects: 100% (73/73), 5.63 MiB | 541.00 KiB/s, done.
Resolving deltas: 100% (11/11), done.
Checking connectivity... done.
[rday@servo .moneydance]$ ls
archive  config.dict  Documents  errlog.txt  fmodules  stockExchanges.dict  tmp
  • fire up the program and it works, containing the latest data