Sample Header Ad - 728x90

ssh percent_expand token %n not working

4 votes
1 answer
3019 views
I'm seeing in the **ssh_config** man page and on the **openssh** website that I should be able to use a **%n token** when locating the identity file for a given host entry. percent_expand tokens used by OpenSSH's ssh(1) and sshd(8) GitHub allows using ssh tokens as deploy tokens but prevents you from using a token more than once on multiple repositories. So I wanted to use globbing to create a single profile regardless of how many individual project keys I had to create: host github-* Hostname github.com User git IdentityFile %d/.ssh/github/%n IdentitiesOnly yes Then I put a github-MyPackage public/private key pair under the ~/.ssh/github/ directory. It finds the globbed profile and the %d works fine but if I try to do a git clone with the %n to find the Identity file name from the original command-line specified host-alias: > git clone github-MyPackage:/myorganization/MyPackage.git Cloning into 'MyPackage'... percent_expand: unknown key %n fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. This is not simply how git accesses it as it also fails with just a simple ssh command: > ssh github-MyPackage percent_expand: unknown key %n I tried googling but didn't find anything on %n. Is this not fully implemented or is there something I'm doing wrong?
Asked by Scott (151 rep)
Feb 18, 2021, 06:57 PM
Last activity: Apr 12, 2025, 09:07 AM