Mirror a Git Repo directly to AWS CodeCommit

早过忘川 提交于 2019-12-01 17:39:10

问题


I want to create a backup of one fo my Git Repository and save it to AWS CodeCommit. I don't want to include the use of my local machine. Can anyone tell me how can I do it directly or through AWS Lambda?


回答1:


I just started searching for the answer to this very question. Before I post some of my preliminary data have you found a solution to this?

Here is what I have found so far:

  • BitBucket

    https://github.com/ef-labs/stash-hook-mirror

  • GitHub

    https://github.com/gitbucket/gitbucket/issues/833

    https://help.github.com/articles/about-webhooks/

  • JGit

    https://fancybeans.com/2012/08/24/how-to-use-s3-as-a-private-git-repository/

  • Gitlab

    How to create a Gitlab webhook to update a mirror repo on Github? especially the part here

I successfully used the mirror feature to automatically pull a GitHub Repository into GitLab using the mirror feature offered by GitLab.com.

I also found https://github.com/lambci/lambci which is serverless CI and looks promising.

I believe the answer lies in a combination of AWS SNS Topic monitoring of Webhooks (GitLab and others) and pass the response to Lambda which spins up an instance which has either git or jgit to run the command, look through the LambCI Repository for details.

The only problem with this solution is that the AWS Lambda instance will clone the mirrored repository to its local storage and then push to AWS Code Commit and this will be repeated each time an instance gets started so for LARGE repositories or VERY ACTIVE repositories this may not be a good idea and you would be better off spinning up a nano EC2 instance with a CRON job to mirror the repository to AWS Code Commit.




回答2:


AWS Quickstart provide a solution that copies your repo to s3 using lambda and webhooks.

This solution could quite easily be modified to copy to CodeCommit rather than s3.




回答3:


It seems migrating directly from Github to AWS Code-commit is not available in the AWS documentation. The following links have some scripts that can do the migration using a local machine.

Please check:

http://www.paul-kearney.com/2015/09/migrating-from-github-to-aws-codecommit.html

https://gist.github.com/paulkearney/6042561c56654a15af3c



来源:https://stackoverflow.com/questions/44898431/mirror-a-git-repo-directly-to-aws-codecommit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!