Page History
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# parameterizationParameterization $gitServer = 'github.com' $gitAccount = 'myAccount' $gitUserName = 'My Account' $gitUserMail = 'myAccount@example.com' $gitKeyFile = 'myKey.rsa' # Connection Import-Module JS7 Connect-JS7 -Url http://root:root@localhost:4446 -Id 'Controller' # useUse of private key file Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -KeyFile $gitKeyFile -UserName $gitUserName -UserMail $gitUserMail # useUse of access token (similarly insecure as use of passwords) # Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -AccessToken 'a1b2c3d4e5f6g7h8' -UserName $gitUserName -UserMail $gitUserMail # useUse of password (denied by a larger number of Git Servers) # Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -Password (ConvertTo-SecureString 'secret' -AsPlainText -Force) -UserName $gitUserName -UserMail $gitUserMail # removeRemove Git credentials Remove-JS7GitCredentials -Server $gitServer # Connection Disconnect-JS7 |
Explanation:
- Line 2-6: Variables are used by the subsequent examples.
- Line 9-10: The JS7 PowerShell Module is loaded and the connection to JOC Cockpit is established, see JS7 - How to connect to JOC Cockpit using the PowerShell Module.
- Line 13: The Add-JS7GitCredentials cmdlet allows to store Git credentials with the user account's profile. A private key file is specified. This file has to exist and is expected in the locations indicated with JS7 - Inventory Git Integration, chapter: Manage Credentials for Git Access.
- Line 1923: The Remove-JS7GitCredentials cmdlet deletes Git credentials from the user account's profile.
- Line 26: The connection to JOC Cockpit is closed.
Overview
Content Tools