alias
- The name of the Alias
dir
- Optional, the directory to use, defaults to the .ssh
folder in the users home directory
Adds an SSH key to the ssh key-agent
const gam = require('git-alias-manager');
console.log('Folder: ' + gam.addSshKeyAgent('alias', '/.ssh'));
No output
dir
- Optional, the directory to use, defaults to the .ssh
folder in the users home directory
Creates a backup of all of the files found in a directory, then returns the name of the created folder
const gam = require('git-alias-manager');
console.log('Folder: ' + gam.backup('/.ssh'));
Would output (assuming the date is April 8th, 2020):
Folder: backup-04-08-2020
customStr
- Custom String to display at the end of the choose alias prompt
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Prompts the user to choose an alias from the list of available aliases associated with ssh keys, then returns the alias
const gam = require('git-alias-manager');
gam.chooseAlias('', dir).then(function(alias){
console.log('Alias: ' + alias);
});
Would output (after choosing an alias):
? Choose an alias: Megapixel99
Alias: Megapixel99
alias
- Optional, name of the new Alias
email
- Optional, email associated with the new SSH Key for the new Alias
passphrase
- Optional, the passphrase to use when using the new SSH Key
bits
- Optional, the number of bits in the SSH key hash, defaults to 4096, the minimum in 1024
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Prompts the user to enter the information required to create a new SSH key for a new alias, if any required information passed to this method is null
, the user will be prompted to enter the necessary information, then returns the information
const gam = require('git-alias-manager');
gam.createAlias('alias', '[email protected]',
'passphrase', 2048, '/.ssh').then(function (res) {
console.log(res);
});
Would output:
{
"alias": "alias",
"email": "[email protected]",
"passphrase": "passphrase",
"bits": 2048,
"dir": "/.ssh"
}
and
const gam = require('git-alias-manager');
gam.createAlias().then(function (res) {
console.log(res);
});
Would output:
? Please enter an alias to be associated with this new git profile: alias
? Please enter an email, to be associated with this new git profile: [email protected]
? Please enter a passphrase (leave empty for no passphrase): [hidden]
? Please re-enter the passphrase (leave empty for no passphrase): [hidden]
{
"alias": "alias",
"email": "[email protected]",
"passphrase": "",
"bits": 4096,
"dir": "/.ssh"
}
alias
- Name of the Alias
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Updates the current git email and SSH keys to that of the current user, then returns the alias
const gam = require('git-alias-manager');
gam.changeAlias('alias', '/.ssh').then(function (res) {
console.log('Alias: ' + res);
});
Would output:
Alias: alias
Retrieves the current email for the users local and global git config
const gam = require('git-alias-manager');
console.log(gam.currentAliasEmail());
Would output:
{
"localEmail": "[email protected]",
"globalEmail": "[email protected]"
}
alias
- Name of the Alias
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Deletes the SSH keys for an alias, then returns the alias
const gam = require('git-alias-manager');
gam.deleteAlias('alias', '/.ssh').then(function (res) {
console.log('Alias: ' + res);
});
Would output:
Alias: alias
alias
- The name of the Alias
email
- The email associated with the new SSH Key for the Alias
passphrase
- The passphrase to use when using the new SSH Key
bits
- Optional, the number of bits in the SSH key hash, defaults to 4096, the minimum in 1024
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Generates and SSH Key for an alias, and saves it to the directory: dir
const gam = require('git-alias-manager');
console.log(gam.generateKey('alias', 'email',
'passphrase', 2048, '/.ssh');
No output
alias
- The name of the Alias
dir
- Optional, the directory to search in, defaults to the .ssh
folder in the users home directory
Retrieves the email associated with an alias
const gam = require('git-alias-manager');
console.log(gam.getAliasEmail('alias', '/.ssh');
Would output:
{
"email": "[email protected]"
}