{"id":13603114,"url":"https://github.com/desktop/desktop-trampoline","last_synced_at":"2025-08-15T15:21:00.067Z","repository":{"id":42668172,"uuid":"334146301","full_name":"desktop/desktop-trampoline","owner":"desktop","description":"A cross-platform no-dependency TCP-based trampoline for GitHub Desktop, written in C","archived":false,"fork":false,"pushed_at":"2025-03-07T14:28:42.000Z","size":283,"stargazers_count":29,"open_issues_count":9,"forks_count":14,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-08T17:14:29.418Z","etag":null,"topics":["askpass","c","git","github","github-desktop"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/desktop.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2021-01-29T12:57:28.000Z","updated_at":"2025-07-31T20:29:34.000Z","dependencies_parsed_at":"2025-04-09T19:16:57.932Z","dependency_job_id":"fc9e99e2-98ca-4449-9213-ee554051524d","html_url":"https://github.com/desktop/desktop-trampoline","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/desktop/desktop-trampoline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desktop%2Fdesktop-trampoline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desktop%2Fdesktop-trampoline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desktop%2Fdesktop-trampoline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desktop%2Fdesktop-trampoline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/desktop","download_url":"https://codeload.github.com/desktop/desktop-trampoline/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desktop%2Fdesktop-trampoline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270586487,"owners_count":24611317,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"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":["askpass","c","git","github","github-desktop"],"created_at":"2024-08-01T18:01:51.853Z","updated_at":"2025-08-15T15:21:00.043Z","avatar_url":"https://github.com/desktop.png","language":"C","readme":"# Desktop Trampoline\n\nA cross-platform no-dependency C executable trampoline which lets GitHub Desktop\nintercede in order to provide Git with any additional info it needs (like\ncredentials through `GIT_ASKPASS` or `SSH_ASKPASS`).\n\nThe intention is to support the same platforms that\n[Electron supports](https://www.electronjs.org/docs/tutorial/support#supported-platforms).\n\n## Building\n\nThis project is written as a Node project with the C-portions being compiled by\nnode-gyp. Installing dependencies and building requires Node.js, and yarn. With\nthose prerequisites the initial setup should be as easy as running `yarn` and\nsubsequent builds can be done using `yarn build`. There are some tests available\nby running `yarn test`.\n\n## Purpose\n\nWhen doing any Git operation that requires authentication in Desktop, the\napplication needs a way to provide those credentials to Git. There are several\noptions available:\n\n- rely on the user's `credential.helper` config setting\n- implement our own\n  [credential storage](https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage)\n  that supports the full credential surface\n- implement a program that handles the Git AskPass protocol\n\nThe first option is unsatisfactory because it can be challenging to setup\ncorrectly, or may be changed under us.\n\nThe second option is excessive - the account details are already managed in\nGitHub Desktop, and we only need to provide the credentials to Git when\nrequired.\n\nThe third option is what we have currently settled on. An added benefit of this\nis it can be configured to ignore any fallback options when authenticating -\nreducing the potential for problems integrating with an existing Git setup.\n\n## What's a Trampoline?\n\nThere are many different descriptions for \"trampoline\" in computing but in this\nsituation the trampoline is a component to pass inputs and outputs between\nprograms that are otherwise challenging to integrate.\n\nOn one side, we have Git, which has a number of ways it can authenticate the\nuser against a HTTPS remote.\n\nOn the other side, we have GitHub Desktop - an Electron app that is primarily\nrunning as a GUI. Electron also supports\n[environment variables](https://electronjs.org/docs/api/environment-variables)\nthat allow us to run it like a command-line program.\n\nTo set an AskPass program for Git, we set the `GIT_ASKPASS` environment variable\nto our executable on disk. This is done by Desktop whenever it needs to spawn a\nGit operation that might require authentication.\n\nThe equivalent Bash shell code looks like this:\n\n```sh\n  # environment variable\n  GIT_ASKPASS=\"C:/some/path/to/desktop-askpass-trampoline.exe\" \\\n  # ensure Git doesn't block the process waiting for the user to provide input\n  GIT_TERMINAL_PROMPT=0 \\\n  git \\\n  # unset the credential.helper defined in config\n  -c credential.helper= \\\n  clone https://github.com/shiftkey/my-private-repo.git\n```\n\nDesktop also sets these environment variables when spawning Git, as it's the\nonly way to pass information down to the authentication process:\n\n- `DESKTOP_USERNAME` - the account associated with the current repository\n- `DESKTOP_ENDPOINT` - the endpoint associated with the account\n\nWith this trampoline, all this info can be passed from GitHub Desktop to Git,\nand then back to GitHub Desktop via a TCP socket when Git requires us the user\ncredentials, so Desktop can act based on that username and endpoint.\n\n## Why Need An Executable?\n\nThis was originally written as a batch file, which looked like this:\n\n```sh\n@echo off\nsetlocal\n\nset ELECTRON_RUN_AS_NODE=1\nset ELECTRON_NO_ATTACH_CONSOLE=1\n\n\"%DESKTOP_PATH%\" \"%DESKTOP_ASKPASS_SCRIPT%\" %*\n\nendlocal\n```\n\nWhile this is much more succinct than this C version, it has some technical\nlimitations that we cannot work around:\n\n- batch files on Windows are launched using `cmd /c {path}` and there are a\n  number of known limitations with Unicode characters in file paths\n- the Golang runtime - which Git LFS is built upon - also has problems launching\n  batch files with spaces -\n  [golang/go#17149](https://github.com/golang/go/issues/17149)\n\nBecause some of our Desktop users don't have control over the account name on\ntheir machine - think students on a machine managed by their university IT\nstaff, for example. We need to support these users in Desktop.\n\nThere are also some things missing from this script that are not easy to\nimplement in batch files, such as adding logging to help diagnose environmental\nissues.\n\nThankfully if you set an executable for your `GIT_ASKPASS` environment variable,\nit avoids all these problems as Windows can just execute the program.\n\n## Why Need A TCP Server?\n\nThe main reason for using a TCP server is that it provides a generic and very\npowerful mechanism for GitHub Desktop to interoperate with Git and handle any\nother protocol Git would require in order to supply any kind of info.\n\nThanks to this, with only one generic trampoline that forwards everything via\nthat TCP socket, the implementation for every possible protocol like\n`GIT_ASKPASS` can live within the GitHub Desktop codebase instead of having\nmultiple trampoline executables.\n\n## SSH Wrapper\n\nAlong with the trampoline, an SSH wrapper is provided for macOS. The reason for\nthis is macOS before Monterey include an \"old\" version of OpenSSH that will\nignore the `SSH_ASKPASS` variable unless it's unable to write to a tty.\n\nThis SSH wrapper achieves exactly that: just runs whatever `ssh` exists in the\npath in a way that will use `SSH_ASKPASS` when necessary.\n\nMore recent versions of OpenSSH (starting with 8.3) don't require this wrapper,\nsince they added support for a new `SSH_ASKPASS_REQUIRE` environment variable.\n","funding_links":[],"categories":["c"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesktop%2Fdesktop-trampoline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdesktop%2Fdesktop-trampoline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesktop%2Fdesktop-trampoline/lists"}