Hosting Git

Toomanycats bio photo By Toomanycats

I wanted a private secure git repository for my encrypted password storage. I would typically use my work computer for such a thing, although I haven’t worked in a laboratory lately. I remembered that my university account was still active and I could use that temporarily.

No SUDO Privileges

The machine I will use runs CentOS and the trick will be to install git without access to yum. That means building git from source. Getting the source is easy and there’s decent install instructions as well.

  • Get the source git
    • Obviously we can’t git clone
    • Download the zip version from Github
      • scp to the future host
  • use configure to set the install directory
  • Turn off any “fancy” features that will require more dependencies
    • According to the INSTALL doc
      • NO_PERL (had an error and it’s optional)
      • NO_OPENSSL b/c my curl -V < 7. 34. 0
      • NO_EXPAT seems purely optional

Assuming you have downloaded the zip version of the source and you have uploaded the archive to your home directory on the target machine:

unzip git-master. zip
cd git-master. zip

make configure
./configure --prefix=/home/user/bin
make NO_PERL=YesPlease NO_OPENSSL=YesPlease NO_EXPAT=YesPlease
make install

Testing

I initiated a new empty GIT repo in my home directory, git_password_store.

mkdir git_password_store
cd git_password_store
git init

I already have a private repo on Bitbucket.com for my encrypted passwords and I’m not removing it until this new repo is has worked for a few months.Therefore I’m adding another remote URL.

cd .password_store
git remote add other-repo username@IP:/home/user/git_password_store
it remote -v

git push other-repo master

Gotcha

You cannot have the same branch checked out on the server. I make a branch called other-branch as a work around, and switch to that.

Here’s the error:

! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'user@IP:/home/users/username/git_password_store'

My work around is to simply create another branch on the new git server and switch to that. You can read some other ideas on SO

My GIT repo is working on my old school account and so far no one has complained or taken it down. I use an SSH key to login as well. Hopefully if I take precautions then the admin will me alone.