Page History
...
Git access includes to authenticate with the Git server Server and to access remote repositories.
The below information is not specific for use with PowerShell, but is available for explanation purposes.steps to set up Git Access
Manual Configuration
Git Configuration File
A Git client reads configuration items from the following file (assuming a user account me
):
...
- The settings map use of a specific private key identity file to authentication with a specific Git serverServer.
Git Configuration Items
A typical configuration step performed with a Git client looks like this:
Code Block | ||||
---|---|---|---|---|
| ||||
# Specify user name git config --global user.name "ItsMy MeAccount" # Specify e-mail addresseaddress git config --global user.email "its.me@examplemyAccount@example.com" # Use simple merge strategy git config --global push.default simple |
Automation with the JS7 PowerShell Module
Users who whish to automate the steps to set up Git access can use the following resources:
- The JS7 - REST Web Service API allows to perform the same operations for Git integration as offered from the JOC Cockpit GUI.
- The JS7 - PowerShell Module offers simplified access to the REST Web Service API for scripting purposes.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when used with the
-debug
option.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when used with the
Find the documentation for related cmdlets from PowerShell CLI 2.0 - Cmdlets - Git Repository Integration.
Display feature availability | ||
---|---|---|
|
The Add-JS7GitCredentials
cmdlet allows to store Git credentials with JOC Cockpit like this
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
# parameterization
$gitServer = 'github.com'
$gitAccount = 'myAccount'
$gitUserName = 'My Account'
$gitUserMail = 'myAccount@example.com'
$gitKeyFile = 'myKey.rsa'
# use of private key file
Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -KeyFile $gitKeyFile -UserName $gitUserName -UserMail $gitUserMail
# use of access token (similarly insecure as use of passwords)
# Add-JS7GitCredentials -Server $gitServer -Account $gitAccount -AccessToken 'a1b2c3d4e5f6g7h8' -UserName $gitUserName -UserMail $gitUserMail
# use 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
# remove Git credentials
Remove-JS7GitCredentials -Server $gitServer |
Explanation:
- Line 2-6: Parameters used by the subsequent examples.
- Line 10: A private key file is specified. This file has to exist and is expected in the