Test a user's SSH key against a git server
POST/api/test_user_ssh_connection/:name
Attempts a key-only SSH authentication against the given git server with the key the user's profile points at, and reports whether it was accepted.
Authenticates with that one key and nothing else - no SSH agent, and no other key present on the server - so a pass means this key works, which is the only useful answer. It asks the host whether it accepts the key rather than reading a repository, so one test covers every repository on that host and the repository part of a URL is ignored.
It can neither hang nor prompt: interactive prompts are refused and the connection is bounded by a timeout, so a firewalled host comes back as a failed test rather than a stalled request.
First contact with a host records its host key for that user (trust on first use), so a later test that finds a different key fails loudly rather than shrugging.
Request
Responses
- 200
- 400
- 403
- 404
- 422
- 500
Successful Response
The submitted server is not a valid host, or the user has no key configured.
Testing another user's key requires the Manage users permission.
User not found
Validation Error
ssh is unavailable on the server.