Page History
...
Git access includes to authenticate with the a Git Server and to access remote repositories.
The steps to set up Git Accessaccess to a Git Server can be manually applied and can be applied by use of the JS7 REST Web Service API.
Manual Configuration
Git Configuration File
A JOC Cockpit makes use of a Git client that reads configuration items from the following file (assuming a user account me
being in place):
- for Unix environments:
/home/me/.ssh/config
- for Windows environments:
C:\Users\me\.ssh\config
The Git config
file can look like this:
Code Block | ||||
---|---|---|---|---|
| ||||
Host github.com Hostname github.com IdentityFile C:\Users\me\.ssh\github_rsa IdentitiesOnly yes |
Explanation:
- The settings map maps use of a specific private key file to authentication with a specific Git Server.
Git Configuration Items
...
Code Block | ||||
---|---|---|---|---|
| ||||
# Specify user name git config --global user.name "My Account" # Specify e-mail address git config --global user.email "myAccount@example.com" # Use simple merge strategy git config --global push.default simple |
Automation with the JS7
...
REST Web Service API
Users who whish to automate the steps to set up Git access can use the following resources:
...
Display feature availability | ||
---|---|---|
|
Add-JS7GitCredentials
cmdlet allows to store Git credentials with JOC Cockpit like thisCode 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 Variables are used by the subsequent examples.
- Line 10: A 9: 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 the locations indicated with JS7 - Inventory Git Integration, chapter: Manage Credentials for Git Access.
- Line 19: The Remove-JS7GitCredentials cmdlet deletes Git credentials from the user account's profile.
Overview
Content Tools