mirror of
https://github.com/webfactory/ssh-agent.git
synced 2024-11-23 09:40:48 +00:00
Make sure file creation works
This commit is contained in:
parent
feedd601c5
commit
e0d767fd8e
3 changed files with 16 additions and 6 deletions
2
.github/workflows/demo.yml
vendored
2
.github/workflows/demo.yml
vendored
|
@ -58,6 +58,8 @@ jobs:
|
||||||
${{ secrets.MPDUDE_TEST_1_DEPLOY_KEY }}
|
${{ secrets.MPDUDE_TEST_1_DEPLOY_KEY }}
|
||||||
${{ secrets.MPDUDE_TEST_2_DEPLOY_KEY }}
|
${{ secrets.MPDUDE_TEST_2_DEPLOY_KEY }}
|
||||||
- run: |
|
- run: |
|
||||||
|
dir c:\\
|
||||||
|
dir c:\\dev
|
||||||
ssh-add -l
|
ssh-add -l
|
||||||
git clone git@github.com:mpdude/test-2.git test-2-git
|
git clone git@github.com:mpdude/test-2.git test-2-git
|
||||||
|
|
||||||
|
|
10
dist/index.js
vendored
10
dist/index.js
vendored
|
@ -138,8 +138,8 @@ try {
|
||||||
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
|
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
|
||||||
|
|
||||||
// Work around https://github.com/PowerShell/openssh-portable/pull/447 by creating a \dev\tty file
|
// Work around https://github.com/PowerShell/openssh-portable/pull/447 by creating a \dev\tty file
|
||||||
fs.mkdirSync('\\dev');
|
fs.mkdirSync('c:\\dev');
|
||||||
fs.closeSync(fs.openSync('\\dev\\tty', 'a'));
|
fs.closeSync(fs.openSync('c:\\dev\\tty', 'a'));
|
||||||
|
|
||||||
home = os.homedir();
|
home = os.homedir();
|
||||||
} else {
|
} else {
|
||||||
|
@ -215,11 +215,15 @@ try {
|
||||||
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
||||||
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
||||||
|
|
||||||
|
// On Linux and OS X, IdentitiesOnly=no will send all keys from agent before the explicit key, so use "yes".
|
||||||
|
// On Windows, IdentitiesOnly=yes will ignore keys from the agent, but send explicit keys first; so use "no" (https://github.com/PowerShell/Win32-OpenSSH/issues/1550)
|
||||||
|
let identitiesOnly = isWindows ? 'no' : 'yes';
|
||||||
|
|
||||||
// Use IdentitiesOnly=no due to https://github.com/PowerShell/Win32-OpenSSH/issues/1550
|
// Use IdentitiesOnly=no due to https://github.com/PowerShell/Win32-OpenSSH/issues/1550
|
||||||
let sshConfig = `\nHost key-${keyNumber}\n`
|
let sshConfig = `\nHost key-${keyNumber}\n`
|
||||||
+ ` HostName github.com\n`
|
+ ` HostName github.com\n`
|
||||||
+ ` User git\n`
|
+ ` User git\n`
|
||||||
+ ` IdentitiesOnly no\n`
|
+ ` IdentitiesOnly ${identitiesOnly}\n`
|
||||||
+ ` IdentityFile ${keyFile}\n`;
|
+ ` IdentityFile ${keyFile}\n`;
|
||||||
|
|
||||||
fs.appendFileSync(`${homeSsh}/config`, sshConfig);
|
fs.appendFileSync(`${homeSsh}/config`, sshConfig);
|
||||||
|
|
10
index.js
10
index.js
|
@ -21,8 +21,8 @@ try {
|
||||||
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
|
child_process.execSync('sc config ssh-agent start=demand', { stdio: 'inherit' });
|
||||||
|
|
||||||
// Work around https://github.com/PowerShell/openssh-portable/pull/447 by creating a \dev\tty file
|
// Work around https://github.com/PowerShell/openssh-portable/pull/447 by creating a \dev\tty file
|
||||||
fs.mkdirSync('\\dev');
|
fs.mkdirSync('c:\\dev');
|
||||||
fs.closeSync(fs.openSync('\\dev\\tty', 'a'));
|
fs.closeSync(fs.openSync('c:\\dev\\tty', 'a'));
|
||||||
|
|
||||||
home = os.homedir();
|
home = os.homedir();
|
||||||
} else {
|
} else {
|
||||||
|
@ -98,11 +98,15 @@ try {
|
||||||
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "git@github.com:${ownerAndRepo}"`);
|
||||||
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
child_process.execSync(`git config --global --add url."git@key-${keyNumber}:${ownerAndRepo}".insteadOf "ssh://git@github.com/${ownerAndRepo}"`);
|
||||||
|
|
||||||
|
// On Linux and OS X, IdentitiesOnly=no will send all keys from agent before the explicit key, so use "yes".
|
||||||
|
// On Windows, IdentitiesOnly=yes will ignore keys from the agent, but send explicit keys first; so use "no" (https://github.com/PowerShell/Win32-OpenSSH/issues/1550)
|
||||||
|
let identitiesOnly = isWindows ? 'no' : 'yes';
|
||||||
|
|
||||||
// Use IdentitiesOnly=no due to https://github.com/PowerShell/Win32-OpenSSH/issues/1550
|
// Use IdentitiesOnly=no due to https://github.com/PowerShell/Win32-OpenSSH/issues/1550
|
||||||
let sshConfig = `\nHost key-${keyNumber}\n`
|
let sshConfig = `\nHost key-${keyNumber}\n`
|
||||||
+ ` HostName github.com\n`
|
+ ` HostName github.com\n`
|
||||||
+ ` User git\n`
|
+ ` User git\n`
|
||||||
+ ` IdentitiesOnly no\n`
|
+ ` IdentitiesOnly ${identitiesOnly}\n`
|
||||||
+ ` IdentityFile ${keyFile}\n`;
|
+ ` IdentityFile ${keyFile}\n`;
|
||||||
|
|
||||||
fs.appendFileSync(`${homeSsh}/config`, sshConfig);
|
fs.appendFileSync(`${homeSsh}/config`, sshConfig);
|
||||||
|
|
Loading…
Reference in a new issue