Skip to content
hook for mirroring stash repos with key authtorization
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


With this hook you may mirror your stash repos to github (or another code hosting) without saving your github password to stash.


For using this hook you must install atlassian external hooks first. Then clone this repo and copy hook script to external hooks path on stash server:

git clone

cd stash-mirror-with-key

scp root@stashhost:/path/to/stash-home/data/external-hooks/

scp root@stashhost:/path/to/stash-home/data/external-hooks/

How to use this hook

  1. Generate new deploy key for repo: ssh-keygen -t rsa -C "reponame@stashhost" -f keyname
  2. Create github repo for mirroring
  3. Add created key as deploy key in this repo: xclip → github repo page → settings → Deploy keys → Add deploy key → paste → add key
  4. Add hook to your stash repo: xclip keyname → stash repo page → settings → Hooks → enable External Async Post Receive Hook → paste script hook name in "Executable" field → enable checkbox "Use safe dir" → paste key from buffer to "positional parameters" field (first line must be github SSH clone URL of mirror repo, other lines is private key pasted from buffer) hook options → Save
  5. Profit!


For debug go to hook configuration and change script name from to After that add your email between repo path and private key (on the second line --- one line for each argument). This hook send debug message to your email.

You can’t perform that action at this time.