This package has been deprecated

Author message:

project has moved on

stash-push-mirror

0.0.3 • Public • Published

stash-push-mirror

DEPRECATED

This was a preliminary proof of concept, and has morphed into a developer documentation server. Hopefully, that will be on GitHub soon.


This is a fork of git-http-server, which adds one feature (so far): the ability to restrict access by client ip address.

This is a proof-of-concept solution for creating mirrors on the filesystem of Git repositories served by Atlassian Stash.

In a nutshell, the way it works is by serving a set of bare git repositories over http, but only allowing pushes from one specified IP address (the address of the machine running Stash). You can then enable the Repository Mirror hook plugin, for each of the desired repositories, such that when there is a push to that repo, Stash relays it along to this server, which writes the changed files to a local checked out copy.

To set it up for one Stash repo, do the following. (Note that most of these steps could be automated.)

npm install --g stash-push-mirror

Create a new directory named stash-mirror somewhere on your server, and then create the following directory tree:

stash-mirror
├── mirrors
│   ├── proj1-repo
│   └── proj2-repo
└── repos

Clone each of the bare repos from Stash, from the stash-mirror/repos directory:

git clone --bare ssh://git@stash.../proj1/repo.git proj1-repo.git
git clone --bare ssh://git@stash.../proj2/repo.git proj2-repo.git

For each repository, create the post-receive hook. Create a file in, for example, proj1-repo.git/hooks, named post-receive, with the following content:

#!/bin/sh 
GIT_WORK_TREE=/abs/path/to/stash-mirror/mirrors/proj1-repo git checkout -f

Then, make them executable; e.g.:

chmod +x post-receive

Start the server from the stash-mirror/repos directory:

cd $REPOS stash-push-mirror -i <stash-ip>

Test it first by going to a terminal on some other machine, and execute:

curl -s -D - http://<mirror-host>:8174

Verify that you get a "403".

Next to go stash, and enable the mirror hook plugin for that repo, and give it:

  • URL: http://<mirror-host>:8174/myproject/myrepo.git
  • Username: demo
  • Password: demo

Push to the Stash repo from some other source and verify that your changes end up in the mirror directory.

For more usage information on the command, use -h to get.

License

MIT License

Readme

Keywords

Package Sidebar

Install

npm i stash-push-mirror

Weekly Downloads

2

Version

0.0.3

License

none

Last publish

Collaborators

  • klortho