Docs: Add instructions for how to configure git to use an ssh key without ssh-agent
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
-
Start this issue's title with Docs:orDocs feedback:.
Problem to solve
Doc Section Affected: (User/SSH/Generate An SSH Key Pair)[https://docs.gitlab.com/user/ssh/#generate-an-ssh-key-pair] In the codebase: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/user/ssh.md#generate-an-ssh-key-pair
The process that's not addressed sufficiently:
If a user wants to use git with an ssh key, but does not have the admin privileges to run ssh-agent.
Currently, the docs do not address the above process and assumes the user is able to run ssh-agent, which may not always be the case.
Further details
Usecase: Users do not have admin privileges on their operating system, but still want to serve/use their ssh key with git.
References: git config option core.sshCommand
Proposal
Add a section in docs for how users can configure git to use core.sshCommand if they do not have the privileges to run ssh-agent.
Something like so:
### Configure Git to use an SSH key without administrative privileges
If you do not have sufficient privileges to run `ssh-agent`, you may not be able to serve your SSH key such that git recognizes your SSH key. In such a case, you can still configure git to use a particular SSH key.
This can be done with the `git config` option [`core.sshCommand`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-coresshCommand).
Create the `~/.git/config` file if it doesn't exist and add the following line: `sshCommand = "ssh -i <ssh_private_key>"`.
E.g.
```gitconfig
sshCommand = "ssh -i ~/.ssh/id_ed25519"
## Who can address the issue
<!-- What if any special expertise is required to resolve this issue? -->
No special expertise required
## Other links/references
<!-- For example, related GitLab issues/MRs -->
N/A
/label ~"documentation"
/label ~"docs-only"
/label ~"type::maintenance" ~"maintenance::refactor"
/milestone %Backlog