Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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
titleExample for Git config file
linenumberstrue
# 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:

Find the documentation for related cmdlets from PowerShell CLI 2.0 - Cmdlets - Git Repository Integration.

Display feature availability
StartingFromRelease2.3.0


The Add-JS7GitCredentials cmdlet allows to store Git credentials with JOC Cockpit like this

Code Block
languagepowershell
titleExample for use of PowerShell cmdlets
linenumberstrue
# 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