Created
October 10, 2014 14:09
-
-
Save thiagovsk/a69ed1de0a749e56d344 to your computer and use it in GitHub Desktop.
Passo a Passo hook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Dado o projeto principal no gitlab | |
e um projeto qualquer no github | |
1- criar uma chave ssh publica com usuario git aonde o gitlab está instalado. | |
$ su git | |
e depois seguir https://help.github.com/articles/generating-ssh-keys/ | |
PS: Não adicionar passprhase | |
2- Adicionar a chave publica ao perfil no github ( alguém com permissão de dar push no repositório). | |
3- Adicionar um remote no repositório do gitlab | |
$ cd /var/opt/gitlab/git-data/repositories/root/colab.git | |
(nosso exemplo é um repositório git chamado colab) | |
$ git remote add --mirror github [email protected]:thiagovsk/teste.git | |
(nosso exemplo é com meu usuário, thiagovsk) | |
Verifique se foi adicionado corretamente | |
$ git remote -v | |
4- Adicione o hook na pasta hooks | |
$ vi hooks/post-receive | |
Adicione essa linha exec( 'git push --mirror github --quiet & ') | |
5- Teste O mirror | |
$ git push --mirror github | |
Verifique se o repositório foi espelhado no github. | |
6- Teste o hook | |
Clone o repositorio que está no gitlab crie um commit, dê um push e veja se replicou no github. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment