Git
Git integration for PowerShell Universal.
PowerShell Universal is capable of synchronizing the configuration scripts with a remote git repository. You can use the Configuration settings to setup git sync.

Git Synchronization Behavior

Two-Way

By default, git synchronization will work both ways. If you make changes within the PSU admin console, those changes will be committed and sync'd to the configured remote.
Any changes that are made in the remote will be pulled locally.
If you setup git sync with a preexisting git remote, the changes will be pulled and synchronized locally. You cannot have any changes locally.
If you setup git sync with a bare repository, the local changes will be sync'd and the repository will be initialized.

One-Way

You can adjust the git synchronization behavior by changing the GitSyncBehavior setting in appsettings.json. When set to OneWay, the admin console and management API will become read-only. The PowerShell Universal system will pull from the remote but will never push or commit locally.
1
"Data": {
2
"RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
3
"ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db",
4
"DatabaseType": "LiteDB",
5
"GitRemote": "https://github.com/myorg/myrepo.git",
6
"GitUserName": "any",
7
"GitPassword": "MYPAT----------------"
8
"GitBranch": "dev",
9
"GitSyncBehavior": "OneWay",
10
"ConfigurationScript": ""
11
},
Copied!

Personal Access Token

We recommend that you use a personal access token (PAT) over a user name and password. You can configure a personal access token by setting the password property in the appsettings.json or other configuration methods.
1
"Data": {
2
"RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
3
"ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db",
4
"GitRemote": "https://github.com/myorg/myrepo.git",
5
"GitUserName": "any",
6
"GitPassword": "MYPAT----------------"
7
},
Copied!

User name and password

You can also configure a git remote to authenticate with a user name and password. Set the user name and password either with the appsettings.json file or another configuration method.
1
"Data": {
2
"RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
3
"ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db",
4
"GitRemote": "https://github.com/myorg/myrepo.git",
5
"GitUserName": "myusername",
6
"GitPassword": "mypassword"
7
},
Copied!
Last modified 7mo ago