Post fetch app compatible with https://github.com/dustin/gitmirror
- Create GitLab user (eg. GitMirror).
- Create GitLab group (eg. Mirrors) and give GitLab user owner permissions.
- Find GitLab user private token: https://my.gitlab.instance.com/profile/account
- Create SSH private key and add it's public part to your GitLab
- And fill the forms:
- GITLAB_PRIVATE_TOKEN: Private token
- GITLAB_URL: Address of your GitLab instance
- GITLAB_GROUP: Where all mirrors should be created
- GITLAB_SSH_KEY: Paste here SSH private key
- GITMIRROR_SECRET: Generate unique password that will secure your GitMirror installation
- Click Deploy For Free
- Open GitHub on project that you want to mirror. Go to Settings -> Webhooks & Services -> Add Webhook:
- Payload URL: Paste URL of your application and add: /callback/github, ie.: https://my-heroku-app.herokuapp.com/callback/github
- Secret: Enter your unique password, the same as GITMIRROR_SECRET.
- Select Just the push event.
- Add Webhook.
- Within a couple of seconds mirror should be created and should be run in sync.
- In case of error you can check Recent Deliveries and Response.
- Create GitLab user (eg. GitMirror).
- Create GitLab group (eg. Mirrors) and give GitLab user owner permissions.
- Find GitLab user private token: https://my.gitlab.instance.com/profile/account
- Create SSH private key and add it's public part to your GitLab
- Click Create and Deploy
- Go to service settings and edit environment variables:
- GITLAB_PRIVATE_TOKEN: Private token
- GITLAB_URL: Address of your GitLab instance
- GITLAB_GROUP: Where all mirrors should be created
- GITLAB_SSH_KEY: Paste here SSH private key
- GITMIRROR_SECRET: Generate unique password that will secure your GitMirror installation
- Open GitHub on project that you want to mirror. Go to Settings -> Webhooks & Services -> Add Webhook:
- Payload URL: Paste URL of your application and add: /callback/github, ie.: http://tutum-ip-address/callback/github
- Secret: Enter your unique password, the same as GITMIRROR_SECRET.
- Select Just the push event.
- Add Webhook.
- Within a couple of seconds mirror should be created and should be run in sync.
- In case of error you can check Recent Deliveries and Response.
go get github.com/ayufan/gitlab-mirror-post-fetch
- Create GitLab user (eg. GitMirror).
- Create GitLab group (eg. Mirrors) and give GitLab user owner permissions.
- Find GitLab user private token: https://my.gitlab.instance.com/profile/account
- Install https://github.com/dustin/gitmirror
- Create
bin/post-fetch
script filling in the blanks:
#!/bin/bash
export GITLAB_PRIVATE_TOKEN=MY_GITMIRROR_USER_PRIVATE_TOKEN
export GITLAB_URL=https://my.gitlab.instance.com/
export GITLAB_GROUP=Mirrors
exec gitlab-mirror-post-fetch
- Give
bin/post-fetch
executable permissions:chmod +x bin/post-fetch
- Configure
gitmirror
script as described. Giving it or notsecret
.
Kamil Trzciński, Polidea, 2014-2015
MIT