{"id":21745179,"url":"https://github.com/zuazo/git-ssh-server-cookbook","last_synced_at":"2025-07-05T20:08:12.027Z","repository":{"id":152868910,"uuid":"10549370","full_name":"zuazo/git-ssh-server-cookbook","owner":"zuazo","description":"Chef cookbook to set up a basic git repository container to be accesed via SSH.","archived":false,"fork":false,"pushed_at":"2015-09-11T11:33:35.000Z","size":361,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T22:05:28.823Z","etag":null,"topics":["chef","cookbook","devops","git","git-server","repository-container","ssh"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/git-ssh-server","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zuazo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-06-07T12:26:21.000Z","updated_at":"2018-02-01T23:17:53.000Z","dependencies_parsed_at":"2023-04-13T16:37:22.913Z","dependency_job_id":null,"html_url":"https://github.com/zuazo/git-ssh-server-cookbook","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuazo%2Fgit-ssh-server-cookbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuazo%2Fgit-ssh-server-cookbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuazo%2Fgit-ssh-server-cookbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zuazo%2Fgit-ssh-server-cookbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zuazo","download_url":"https://codeload.github.com/zuazo/git-ssh-server-cookbook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248665745,"owners_count":21142123,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["chef","cookbook","devops","git","git-server","repository-container","ssh"],"created_at":"2024-11-26T07:13:51.562Z","updated_at":"2025-04-13T05:12:32.551Z","avatar_url":"https://github.com/zuazo.png","language":"Ruby","readme":"Git SSH Server Cookbook\n=======================\n[![Cookbook Version](https://img.shields.io/cookbook/v/git-ssh-server.svg?style=flat)](https://supermarket.chef.io/cookbooks/git-ssh-server)\n[![GitHub Source](https://img.shields.io/badge/source-GitHub-blue.svg?style=flat)](https://github.com/zuazo/git-ssh-server-cookbook)\n[![Dependency Status](http://img.shields.io/gemnasium/zuazo/git-ssh-server-cookbook.svg?style=flat)](https://gemnasium.com/zuazo/git-ssh-server-cookbook)\n[![Build Status](http://img.shields.io/travis/zuazo/git-ssh-server-cookbook.svg?style=flat)](https://travis-ci.org/zuazo/git-ssh-server-cookbook)\n\n[Chef](https://www.chef.io/) cookbook to set up a basic git repository container to be accessed via SSH.\n\nRequirements\n============\n\n## Supported Platforms\n\nThis cookbook has been tested on the following platforms:\n\n* Amazon Linux\n* Arch\n* CentOS\n* Debian\n* Fedora\n* FreeBSD\n* OpenSUSE\n* Oracle Linux\n* RedHat\n* Scientific Linux\n* SUSE\n* Ubuntu\n* Windows\n\nPlease, [let us know](https://github.com/zuazo/git-ssh-server-cookbook/issues/new?title=I%20have%20used%20it%20successfully%20on%20...) if you use it successfully on any other platform.\n\n## Required Cookbooks\n\n* [git](https://supermarket.chef.io/cookbooks/git)\n* [ssh_authorized_keys](https://supermarket.chef.io/cookbooks/ssh_authorized_keys)\n\n## Required Applications\n\n* Ruby `1.9.3` or higher.\n\nAttributes\n==========\n\n| Attribute                             | Default                | Description                    |\n|:--------------------------------------|:-----------------------|:-------------------------------|\n| `node['git-ssh-server']['base_path']` | *calculated*           | Git repository base path.\n| `node['git-ssh-server']['user']`      | `'git'`                | System user used to manage the repositories.\n| `node['git-ssh-server']['group']`     | `'git'`                | System group used to manage the repositories.\n| `node['git-ssh-server']['shell']`     | `'/usr/bin/git-shell'` | Git user shell.\n| `node['git-ssh-server']['hostname']`  | *calculated*           | Machine hostname, used only in the README template.\n\nRecipes\n=======\n\n## git-ssh-server::default\n\nConfigures a git repository container\n\nResources\n=========\n\n## git_ssh_server_bare[name]\n\nCreates a new bare repository.\n\n### git_ssh_server_bare Actions\n\n* `create`: Creates a bare repository (default).\n\n### git_ssh_server_bare Parameters\n\n| Parameters             | Default         | Description                    |\n|:-----------------------|:----------------|:-------------------------------|\n| name                   | *resource name* | Repository name.\n| base_path              | *calculated*    | Git repository base path.\n| add_update_server_hook | `false`         | Create the post-update-hook with `exec git update-server-info` (`true` or `false`).\n\n### git_ssh_server_bare Example\n\n```ruby\ngit_ssh_server_bare 'library1'\n\ngit_ssh_server_bare 'webapp1' do\n  add_update_server_hook true\nend\n```\n\nDefinitions\n===========\n\n## git_ssh_server_ssh_key[keyname]\n\nGrant access to a SSH key to all the repositories.\n\n### git_ssh_server_ssh_key Parameters\n\n| Parameters | Default         | Description              |\n|:-----------|:----------------|:-------------------------|\n| keyname    | *resource name* | SSH key name.\n| key        | *required*      | SSH RSA public key value.\n| keytype    | `'ssh-rsa'`     | SSH RSA key type.\n| base_path  | *calculated*    | Git repository base path.\n\n### git_ssh_server_ssh_key Example\n\n```ruby\n# the SSH public key from your ~/.ssh/*.pub file\ngit_ssh_server_ssh_key 'battle-laptop' do\n  key 'AAAAB3NzaC1yc2EAAAABIwAAAQEA[...]'\nend\n```\n\nUsage Example\n=============\n\n## Including in a Cookbook Recipe\n\n```ruby\ninclude_recipe 'git-ssh-server::default' # or put it in your run_list\n\ngit_ssh_server_bare 'my-library-one'\ngit_ssh_server_bare 'my-library-two'\ngit_ssh_server_bare 'my-webapp'\n\ngit_ssh_server_ssh_key 'my-laptop-key' do\n  key(\n    'AAAAB3NzaC1yc2EAAAADAQABAAABAQDjvOJeZHLa15iajIat6YxtDM2BtVwxZ/WMIcGh6NeQB'\\\n    'I1Nhs4nIpHRCC5bOG4Pg5d6QYaFLDXHx7rHWzprBMi7XuBANGUKESFemByF2DU7hO60/DhA+K'\\\n    'mzeEkCVIqGTh+G7GFucjNGvJgles7MjkOenIc7Xb+OXKcPdTRpQslwJErsIqb1EfRT+8kZvVn'\\\n    '9d9RBS9grWkiOz+d+SVU/D6S40st2f4VDE5NHxcA9/U0vT7tLvC+G6lNJ4+w8M1jpvTDosKeq'\\\n    'yfqQnucf61VWc6ClGh8p88WTSZ081jGB0OkM+nFBsOtzJ+Gmy/N2I+eJGjTykAC7MvLPUsQjA'\\\n    '0KYsZRL'\n  )\nend\n\ngit_ssh_server_ssh_key 'another-developer' do\n  key(\n    'AAAAB3NzaC1yc2EAAAADAQABAAABAQC75j5iuOWD2Xqw/hKVoJ32n0r6jRjlBofjtEkFDknZp'\\\n    'CMG3whdy64FGNvYYgoajLOc/TyhF+ntt/Go3CrasxNhEusnj6HQu57d0nAnnTleDBHLgcCxFW'\\\n    'QrGTXpop+JziHYXpZHT5bvMV0zfw0C6ezheUnlXlA5+2JNZx3JwhfZqu0L18iwOdWzWbL3zta'\\\n    'D84l0e030JTyg6SP/feXvM5bnQpySCWnqk6L2yzhXQh3tpg95l/8srSE1tuRwgWx4gW2k0E9x'\\\n    'gWtDwcx4lsskMdti6vZ/aM4Ll/jTFAO0hmXZEDnsSr0NEuwm/n8jvN9qwHPLBsk2YWf57VPKq'\\\n    'VQ2rYLx'\n  )\nend\n```\n\nDon't forget to include the `git-ssh-server` cookbook as a dependency in the metadata.\n\n```ruby\n# metadata.rb\n# [...]\n\ndepends 'git-ssh-server'\n```\n\n## Including in the Run List\n\nAnother alternative is to include the default recipe in your *Run List*.\n\n```json\n{\n  \"name\": \"git.example.com\",\n  \"[...]\": \"[...]\",\n  \"run_list\": [\n    \"[...]\",\n    \"recipe[git-ssh-server]\"\n  ]\n}\n```\n\nTesting\n=======\n\nSee [TESTING.md](https://github.com/zuazo/git-ssh-server-cookbook/blob/master/TESTING.md).\n\n## ChefSpec Matchers\n\n### git_ssh_server_bare(name)\n\nHelper method for locating a `git_ssh_server_bare` resource in the collection.\n\n```ruby\nresource = chef_run.git_ssh_server_bare(name)\nexpect(resource).to notify('service[apache2]').to(:reload)\n```\n\n### create_git_ssh_server_bare(name)\n\nAssert that the *Chef Run* creates a bare repository in the Git SSH Server.\n\n```ruby\nexpect(chef_run).to create_git_ssh_server_bare(name)\n```\n\n### ChefSpec Matchers for the `git_ssh_server_ssh_key` Definition\n\nTo create ChefSpec tests for the `git_ssh_server_ssh_key` definition, you can use the [`render_file`](http://www.rubydoc.info/github/sethvargo/chefspec#render_file) matcher to check the *authorized_keys* file content:\n\n```ruby\nit 'allows bob to access git repositories' do\n  expect(chef_run).to render_file('/srv/git/.ssh/authorized_keys')\n    .with_content(/^ssh-rsa [A-Za-z0-9+\\/=]+ bob@acme\\.com$/)\nend\n```\n\nYou can also test against the internal template:\n\n```ruby\nit 'creates /srv/git/.ssh/authorized_keys file' do\n  expect(chef_run).to create_template('/srv/git/.ssh/authorized_keys')\nend\n```\n\nContributing\n============\n\nPlease do not hesitate to [open an issue](https://github.com/zuazo/git-ssh-server-cookbook/issues/new) with any questions or problems.\n\nSee [CONTRIBUTING.md](https://github.com/zuazo/git-ssh-server-cookbook/blob/master/CONTRIBUTING.md).\n\nLicense and Author\n==================\n\n|                      |                                          |\n|:---------------------|:-----------------------------------------|\n| **Author:**          | Raúl Rodríguez (\u003craul@onddo.com\u003e)\n| **Author:**          | Xabier de Zuazo (\u003cxabier@zuazo.org\u003e)\n| **Contributor:**     | [Arnold Krille](https://github.com/kampfschlaefer)\n| **Copyright:**       | Copyright (c) 2015, Xabier de Zuazo\n| **Copyright:**       | Copyright (c) 2013 Onddo Labs, SL.\n| **License:**         | Apache License, Version 2.0\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n        http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuazo%2Fgit-ssh-server-cookbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzuazo%2Fgit-ssh-server-cookbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzuazo%2Fgit-ssh-server-cookbook/lists"}