Versions Compared

Key

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

...

Code Block
languagebash
titleExample for Managing Git Credentials using Unix Shell
linenumberstrue
# common options for connection to JS7 REST API
request_options=(--url=http://localhost:4446 --user=root --password=root --controller-id=controller)

# get credentials
./deploy-git.sh get-credentials    "${request_options[@]}"

# store credentials
./deploy-git.sh store-credentials  "${request_options[@]}" --server=github.com --user-account=communitymyAccount \
                                                           --user-name="CommunityMy Account" --user-mail="community@sos-berlinmyAccount@example.com" \
                                                           --user-private-key=/var/sos-berlin.com/js7/joc/resources/joc/repositories/private/sos-communitymyAccount.rsa

# delete credentials
./deploy-git.sh delete-credentials "${request_options[@]}" --server=github.com

...

Code Block
languagepowershell
titleExample for use of PowerShell cmdletsManaging Git Credentials using PowerShell
linenumberstrue
# Parameterization
$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' | Out-Null

# 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

# Connection
Disconnect-JS7

...