{"id":13688606,"url":"https://github.com/progrium/gitreceive","last_synced_at":"2025-05-16T11:06:52.756Z","repository":{"id":6163916,"uuid":"7393598","full_name":"progrium/gitreceive","owner":"progrium","description":"Easily accept and handle arbitrary git pushes","archived":false,"fork":false,"pushed_at":"2021-12-10T10:16:01.000Z","size":56,"stargazers_count":1136,"open_issues_count":15,"forks_count":108,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-04-09T07:02:47.823Z","etag":null,"topics":[],"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/progrium.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}},"created_at":"2013-01-01T06:19:06.000Z","updated_at":"2025-03-22T20:21:32.000Z","dependencies_parsed_at":"2022-08-31T15:51:28.391Z","dependency_job_id":null,"html_url":"https://github.com/progrium/gitreceive","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgitreceive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgitreceive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgitreceive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/progrium%2Fgitreceive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/progrium","download_url":"https://codeload.github.com/progrium/gitreceive/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254518383,"owners_count":22084374,"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":[],"created_at":"2024-08-02T15:01:17.531Z","updated_at":"2025-05-16T11:06:51.764Z","avatar_url":"https://github.com/progrium.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"gitreceive\n==========\n[![Build Status](https://travis-ci.org/progrium/gitreceive.png?branch=master)](https://travis-ci.org/progrium/gitreceive)\n\nCreates an ssh+git user that accepts on the fly repository pushes and triggers a hook script. \n\nPush code anywhere. Extend your Git workflow.\n\ngitreceive dynamically creates bare repositories with a special `pre-receive` hook that triggers your own general gitreceive hook giving you easy access to the code that was pushed while still being able to send output back to the git user.\n\n## Requirements\n\nYou need a Linux server with `git` and `sshd` installed.\n\n## Installing\n\nOn your server, download https://raw.github.com/progrium/gitreceive/master/gitreceive to a location on your $PATH and make it executable.\n\n## Using gitreceive\n\n#### Set up a git user on the server\n\nThis automatically makes a user and home directory if it doesn't exist. \n\n    $ sudo gitreceive init\n    Created receiver script in /home/git for user 'git'.\n\nYou use a different user by setting `GITUSER=somethingelse` in the\nenvironment before using `gitreceive`.\n\n#### Modify the receiver script\n\nAs an example receiver script, it will POST all the data to a RequestBin:\n\n    $ cat /home/git/receiver\n    #!/bin/bash\n    URL=http://requestb.in/rlh4znrl\n    echo \"----\u003e Posting to $URL ...\"\n    curl \\\n      -X 'POST' \\\n      -F \"repository=$1\" \\\n      -F \"revision=$2\" \\\n      -F \"username=$3\" \\\n      -F \"fingerprint=$4\" \\\n      -F contents=@- \\\n      --silent $URL\n    \nThe username is just a name associated with a public key. The\nfingerprint of the key is sent so you can authenticate against the\npublic key that you may have for that user. \n\nCommands do not have access to environment variables from the `/etc/profile` directory, so if you need access to them, you will need to maually `source /etc/profile` - or any other configuration file - within your receiver script.\n\nThe repo contents are streamed into `STDIN` as an uncompressed archive (tar file). You can extract them into a directory on the server with a line like this in your receiver script:\n\n    mkdir -p /some/path \u0026\u0026 cat | tar -x -C /some/path\n\n\n#### Create a user by uploading a public key from your laptop\n\nWe just pipe our local SSH key into the `gitreceive upload-key` command via SSH:\n\n    $ cat ~/.ssh/id_rsa.pub | ssh you@yourserver.com \"sudo gitreceive upload-key \u003cusername\u003e\"\n\nThe `username` argument is just an arbitrary name associated with the key, mostly\nfor use in your system for auth, etc.\n\n`gitreceive upload-key` will authorize this key for use on the `$GITUSER`\naccount on the server, and use the SSH \"forced commands\" syntax in the remote\n`.ssh/authorized_keys` file,  causing the internal `gitreceive run` command to\nbe called when this key is used with the remote git account. This allows us to\nintercept the `git` requests and set up a `pre-receive` hook to run on the\nrepo, which triggers the custom receiver script.\n\n#### Add a remote to a local repository\n\n    $ git remote add demo git@yourserver.com:example\n\nThe repository `example` will be created on the fly when you push.\n\n#### Push!!\n\n    $ git push demo master\n    Counting objects: 5, done.\n    Delta compression using up to 4 threads.\n    Compressing objects: 100% (3/3), done.\n    Writing objects: 100% (3/3), 332 bytes, done.\n    Total 3 (delta 1), reused 0 (delta 0)\n    ----\u003e Receiving progrium/gitreceive.git ... \n    ----\u003e Posting to http://requestb.in/rlh4znrl ...\n    ok\n    To git@gittest:progrium/gitreceive.git\n       59aa541..6eafb55  master -\u003e master\n\nThe receiver script did not attempt to silence the output of curl, so\nthe respones of \"ok\" from RequestBin is shown. Use this to your\nadvantage! You can even use chunked-transfer encoding to stream back\nprogress in realtime if you wanted to keep using HTTP. Alternatively, you can have the\nreceiver script run any other script on the server.\n\n#### Handling submodules\nSubmodules are not included when you do a `git push`, if you want them to be part of your workflow, have a look at [Handling Submodules](https://github.com/progrium/gitreceive/wiki/TipsAndTricks#handling-submodules).\n\n## So what?\n\nYou can use `gitreceive` not only to trigger code on `git push`, but to provide\nfeedback to the user and affect workflow. Use `gitreceive` to:\n\n* Put a `git push` deploy interface in front of App Engine\n* Run your company build/test system as a separate remote\n* Integrate custom systems into your workflow\n* Build your own Heroku\n* Push code anywhere\n\nI used to work at Twilio. Imagine pushing a repo with a TwiML file to a\ngitreceive repo with a phone number for a name. And then it runs that\nTwiML on Twilio and shows you the result, all from the `git push`. \n\n\n## Big Thanks\n\nDotCloud, DigitalOcean\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Fgitreceive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprogrium%2Fgitreceive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprogrium%2Fgitreceive/lists"}