{"id":22615640,"url":"https://github.com/marcellodesales/git-sshd-server-docker","last_synced_at":"2026-04-17T07:33:19.481Z","repository":{"id":142072579,"uuid":"184493912","full_name":"marcellodesales/git-sshd-server-docker","owner":"marcellodesales","description":"Dockerized GIT + SSHD server to be used with any language","archived":false,"fork":false,"pushed_at":"2019-05-02T08:35:56.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T00:42:36.189Z","etag":null,"topics":["alpine","alpine-linux","git","git-server","git-server-docker","github","github-enterprise"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcellodesales.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-01T23:18:30.000Z","updated_at":"2024-06-23T22:34:35.000Z","dependencies_parsed_at":"2023-07-12T00:17:09.208Z","dependency_job_id":null,"html_url":"https://github.com/marcellodesales/git-sshd-server-docker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/marcellodesales/git-sshd-server-docker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fgit-sshd-server-docker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fgit-sshd-server-docker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fgit-sshd-server-docker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fgit-sshd-server-docker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcellodesales","download_url":"https://codeload.github.com/marcellodesales/git-sshd-server-docker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcellodesales%2Fgit-sshd-server-docker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31920157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpine","alpine-linux","git","git-server","git-server-docker","github","github-enterprise"],"created_at":"2024-12-08T19:08:42.186Z","updated_at":"2026-04-17T07:33:19.455Z","avatar_url":"https://github.com/marcellodesales.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github Pre-receive Hook: Base Image\n\nThis is the base image from the Dockerfile https://help.github.com/enterprise/2.6/admin/guides/developer-workflow/creating-a-pre-receive-hook-script/#testing-pre-receive-scripts-locally. This is the first base with Git + SSHD server running without any language-specific implementation.\n\n* You can reuse this image to create pre-receive hook in Python, Golang, Java, etc.\n\n[![resolution](http://dockeri.co/image/marcellodesales/git-sshd-server \"Git SSHD Server Base Image\")](https://hub.docker.com/r/marcellodesales/git-sshd-server/)\n\n# Requirements\n\n* `docker`: latest version\n* `docker-compose`: latest version\n\n# Setup a server\n\n* Using `setup-server.sh`\n\n```console\n$ ./setup-server.sh\n\n##### GIT + SSHD SERVER 1.0.0 #####\n\nWed May  1 16:50:26 PDT 2019\n\n* Setting up a Git Server\n\n==========--------- Building the new docker image -----------==========\n\n* docker-compose build\n\nBuilding marcellodesales-git-sshd-server\nStep 1/6 : FROM alpine:3.9\n ---\u003e cdf98d1859c1\nStep 2/6 : LABEL maintainer=\"marcello.desales@gmail.com\"\n ---\u003e Using cache\n ---\u003e 7e604fd6d428\nStep 3/6 : RUN echo 'PS1=\"$(echo -e \"\\xF0\\x9F\\x90\\xB3\") [\\\\u@\\\\h]:\\\\W \\\\$ \"' \u003e\u003e ~/.bashrc \u0026\u0026   apk add --no-cache git openssh bash \u0026\u0026   ssh-keygen -A \u0026\u0026   sed -i \"s/#AuthorizedKeysFile/AuthorizedKeysFile/g\" /etc/ssh/sshd_config \u0026\u0026   adduser git -D -G root -h /home/git -s /bin/bash \u0026\u0026   passwd -d git \u0026\u0026   su git -c \"mkdir /home/git/.ssh \u0026\u0026      ssh-keygen -t rsa -b 4096 -f /home/git/.ssh/id_rsa -P '' \u0026\u0026      mv /home/git/.ssh/id_rsa.pub /home/git/.ssh/authorized_keys \u0026\u0026      mkdir /home/git/test.git \u0026\u0026      git --bare init /home/git/test.git\"\n ---\u003e Using cache\n ---\u003e f98e34b17a7f\nStep 4/6 : VOLUME [\"/home/git/.ssh\", \"/home/git/test.git/hooks\"]\n ---\u003e Using cache\n ---\u003e 5a2b77fe24e0\nStep 5/6 : WORKDIR /home/git\n ---\u003e Using cache\n ---\u003e 127e54a26ee4\nStep 6/6 : CMD [\"/usr/sbin/sshd\", \"-D\"]\n ---\u003e Using cache\n ---\u003e 5ca61c1ab080\n\nSuccessfully built 5ca61c1ab080\nSuccessfully tagged marcellodesales/git-sshd-server:1.0.0\n\n==========--------- Start a new Git Server -----------==========\n\n* docker-compose up -d\n\nStopping git-sshd-server-docker_marcellodesales-git-sshd-server_1 ... done\nStarting git-sshd-server-docker_marcellodesales-git-sshd-server_1 ... done\n\n==========--------- Copying credentials from Git server Container -----------==========\n\n* Copying the key file id_rsa private from the Git Server\n* docker cp git-sshd-server-docker_marcellodesales-git-sshd-server_1:/home/git/.ssh/id_rsa /Users/mdesales/dev/github/public/marcellodesales/git-sshd-server-docker/.id_rsa_from_git_server\n\n\nWed May  1 16:50:31 PDT 2019\n\n* Finished setting up the server...\n* Now you can run tests with test.sh copying the command below:\n\nGIT_PEM_PATH=/Users/mdesales/dev/github/public/marcellodesales/git-sshd-server-docker/.id_rsa_from_git_server ./test.sh\n```\n\n# Using the server locally\n\n* Linux: try eth0 or eth1\n\n```\n$ git remote add test git@$(ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'):test.git\n```\n\n* Mac: try en0 or en1 depending on wifi or ethernet.\n\n```\n$ git remote add test git@$(ipconfig getifaddr en0):test.git\n```\n\n\u003e Note that you need to `id_rsa_from_container` you copied from the data container described in previous section.\n\n```\n$ GIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i PATH_TO_ID/id_rsa_from_container\" git remote show test\nWarning: Permanently added '[172.16.188.135]:52311' (ECDSA) to the list of known hosts.\n* remote test\n  Fetch URL: git@172.16.188.135:test.git\n  Push  URL: git@172.16.188.135:test.git\n  HEAD branch: (unknown)\n```\n\nAt this point, you are ready to proceed and use the git server. You can use the `test.sh` command to setup and push the initial files to the server:\n\n```console\n$ GIT_PEM_PATH=/Users/mdesales/dev/github/public/marcellodesales/git-sshd-server-docker/.id_rsa_from_github_simulator_server ./test.sh\n\n##### GIT SERVER ######\n\nWed May  1 16:41:36 PDT 2019\n\n==========--------- Git Repo Local Files -----------==========\n\n* Current Dir: /Users/mdesales/dev/github/public/intuit/intuit-spring-cloud-config-validator/repo-test-msaas-2\n\ntotal 72\ndrwxr-xr-x  14 mdesales  CORP\\Domain Users   448 Apr 26 09:24 .\ndrwxr-xr-x  19 mdesales  CORP\\Domain Users   608 May  1 16:20 ..\ndrwxr-xr-x  13 mdesales  CORP\\Domain Users   416 May  1 16:40 .git\n-rw-r--r--   1 mdesales  CORP\\Domain Users    33 Apr 26 02:50 README.md\ndrwxr-xr-x   3 mdesales  CORP\\Domain Users    96 Apr 26 09:24 another\n-rw-r--r--   1 mdesales  CORP\\Domain Users   243 Apr 26 02:50 application.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   494 Apr 26 02:50 config_msaas_test_01-dev.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   494 Apr 26 02:50 config_msaas_test_01-e2e.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   494 Apr 26 02:50 config_msaas_test_01-prd.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   494 Apr 26 02:50 config_msaas_test_01-prf.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   494 Apr 26 02:50 config_msaas_test_01-qal.yml\n-rw-r--r--   1 mdesales  CORP\\Domain Users   358 Apr 26 02:50 config_msaas_test_01.yml\ndrwxr-xr-x   6 mdesales  CORP\\Domain Users   192 Apr 26 09:24 idps\n-rwxr-xr-x   1 mdesales  CORP\\Domain Users  2320 Apr 26 09:15 test.sh\n\n==========--------- Setting Test Remote Origin -----------==========\n\n* Adding the git origin to current directory with server at 172.28.109.247\n\n==========--------- Testing Remote Origin -----------==========\n\n* Conectivity with the repo...\nGIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i /Users/mdesales/dev/github/public/marcellodesales/git-sshd-server-docker/.id_rsa_from_github_simulator_server\" git remote show test\n\nWarning: Permanently added '[172.28.109.247]:52311' (ECDSA) to the list of known hosts.\n* remote test\n  Fetch URL: git@172.28.109.247:test.git\n  Push  URL: git@172.28.109.247:test.git\n  HEAD branch: (unknown)\n\n==========--------- Testing Remote Origin -----------==========\n\n* Executing 'git push' to test github simulator\nGIT_SSH_COMMAND=\"ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 52311 -i /Users/mdesales/dev/github/public/marcellodesales/git-sshd-server-docker/.id_rsa_from_github_simulator_server\" git push -u test master\nWarning: Permanently added '[172.28.109.247]:52311' (ECDSA) to the list of known hosts.\nEnumerating objects: 18, done.\nCounting objects: 100% (18/18), done.\nDelta compression using up to 8 threads\nCompressing objects: 100% (16/16), done.\nWriting objects: 100% (18/18), 11.19 KiB | 1.86 MiB/s, done.\nTotal 18 (delta 0), reused 18 (delta 0)\nTo 172.28.109.247:test.git\n * [new branch]      master -\u003e master\nBranch 'master' set up to track remote branch 'master' from 'test'.\n```\n\n* As you can see, you have pushed the current dir to the test repo.\n* You can interact with the git server by using the commands above.\n* You may choose to add this config into your git config to simplify\n\n# Hooks Implementation\n\n* You can implement pre-receive hooks using specific languages\n* You may create a new `Dockerfile` that starts `FROM` this image to build custom validations\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fgit-sshd-server-docker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcellodesales%2Fgit-sshd-server-docker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcellodesales%2Fgit-sshd-server-docker/lists"}