You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 6 Next »

Introduction

Git access includes to authenticate with the Git Server and to access remote repositories.

The 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):

  • for Unix environments
    • /home/me/.ssh/config
  • for Windows environments
    • C:\Users\me\.ssh\config

The Git config file can look like this:

Example for Git config file
Host github.com
    Hostname github.com
    IdentityFile C:\Users\me\.ssh\github_rsa
    IdentitiesOnly yes

Explanation:

  • The settings map use of a specific private key file to authentication with a specific Git Server.

Git Configuration Items

A typical configuration step performed with a Git client looks like this:

Example for Git config file
# 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 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.

FEATURE AVAILABILITY STARTING FROM RELEASE 2.3.0

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

Example for use of PowerShell cmdlets
# 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 



  • No labels