Sometimes I get stuck where I have a local git repo I want to collaborate with someone on, but I don’t want to go through the hassle of making a public GitHub repo, or setting up an SSH server or guest user on my laptop, or who knows. It’s just a temporary situation and git is distributed revision control, this should be easy!
So I made a little git plugin called git-hostd. You can find it at its
project page on GitHub.
~$ go get github.com/jtolds/gitserve/cmd/git-hostd
Server computer:
~$ mkdir -p myrepo && cd myrepo ~/myrepo$ git init Initialized empty Git repository in /home/jt/myrepo/.git/ ~/myrepo$ touch newfile1 ~/myrepo$ git add . ~/myrepo$ git commit -m 'first commit!' [master (root-commit) 2266e76] first commit! 0 files changed create mode 100644 newfile1 ~/myrepo$ git hostd 2014/08/16 02:11:07 NOTE - listening on [::]:7022
Client computer:
~$ git clone ssh://localhost:7022/ myrepo2 Cloning into 'myrepo2'... Welcome to the gitserve git-hostd code hosting tool! Please see https://github.com/jtolds/gitserve for more info. remote: Counting objects: 3, done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0) Receiving objects: 100% (3/3), done. ~$ cd myrepo2 ~/myrepo2$ touch newfile2 ~/myrepo2$ git add newfile2 ~/myrepo2$ git commit -m 'second commit!' [master 043fcab] second commit! 0 files changed create mode 100644 newfile2 ~/myrepo2$ git push origin HEAD:refs/heads/mybranch Welcome to the gitserve git-hostd code hosting tool! Please see https://github.com/jtolds/gitserve for more info. Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (2/2), 230 bytes, done. Total 2 (delta 0), reused 0 (delta 0) To ssh://localhost:7022/ * [new branch] HEAD -> mybranch ~/myrepo2$
The project originally started as a library for building automatic coding
competition systems hosted via git, so the git-submitd tool allows for pushes
of code along with running checks. Less useful to most people.