How to format Git settings in appsettings.json

How to format Git settings in appsettings.json

avatar
(anonymous user)

Hi,

I did try some options for Git connection, but can’t get a connection and I don’t really understand which username and password must be used.

I don’t know if it makes a difference, but i’m using a private repo.

I checked the documentation and also checked the forum, but I can’t find a example.

  "Data": {
    "RepositoryPath": "%ProgramData%\\UniversalAutomation\\Repository",
    "ConnectionString": "%ProgramData%\\UniversalAutomation\\database.db",
    "GitRemote": "",
    "GitUserName": "",
    "GitPassword": ""
  },

All Comments (22)

avatar

Hi @AnonymousUser,

We need to update the documentation for this. If you are using GitHub, you can create a Personal Access Token instead of using the user name and password. Then your username can be anything and you can use your PAT as the password.

I’ve had success with just using my username and password but I think we’re going to change the recommendation here to use the PAT instead.

Make sure that you include the .git extension when putting in your remote URL.

Adam Driscoll

PowerShell Expert and Software Architect at Devolutions

avatar
(anonymous user)

Hi,

Thanks for the answers, I will try it later because i’m finishing a other project first. Can you tell me what you’re using as the GitRemote format? Like:

  1. HTTPS: https://github.com/QMSPS/Q-PowerAPI.git

  2. git@github.com:QMSPS/Q-PowerAPI.git

Or something else? If you let me know (ore someone else) I will check it.

Kind regards,

ARKO

avatar

We’ve been using format number 1.

Adam Driscoll

PowerShell Expert and Software Architect at Devolutions

avatar

@Adam Driscoll I’m also having an issue with Git sync. I’m receiving the following error in the logs:

2020-07-14T20:08:10.6727961-05:00 [ERR] Failed to sync: "There is no tracking information for the current branch." " at LibGit2Sharp.Commands.Pull(Repository repository, Signature merger, PullOptions options) at UniversalAutomation.Git.GitService.Pull() in C:\src\universal\src\UniversalAutomation.Git\GitService.cs:line 225 at UniversalAutomation.GitSyncService.TrySync() in C:\src\universal\src\UniversalAutomation\Services\GitSyncService.cs:line 83 at UniversalAutomation.GitSyncService.Sync() in C:\src\universal\src\UniversalAutomation\Services\GitSyncService.cs:line 54" (2d6ed692)

avatar

There is no tracking information for the current branch.

Can you check the status of the local git repo using standard git commands? I’m not sure how it got into the state you are in but you might be able to get it straightened out manually and then PSU should be able to sync.

PSU effectively does a git pull followed by a git push during the git sync. We only support a single master branch at the moment and don’t specify that branch specifically.

stackoverflow.com

Adam Driscoll

PowerShell Expert and Software Architect at Devolutions

avatar

@Adam Driscoll thanks for your help. I was able to get the previous commits pushed, but now it fails to push automatically. If I enter the directory, I see that a push is waiting and can push manually, but I’m seeing this in the logs:

2020-07-14T22:49:00.9377294-05:00 [ERR] Failed to sync: "programdata configuration file owner is not valid" " at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) at LibGit2Sharp.Core.Proxy.ConvertPath(Func``2 pathRetriever) at LibGit2Sharp.Core.Proxy.git_config_find_programdata() at LibGit2Sharp.Configuration..ctor(Repository repository, String repositoryConfigurationFileLocation, String globalConfigurationFileLocation, String xdgConfigurationFileLocation, String systemConfigurationFileLocation) at LibGit2Sharp.Repository.<>c__DisplayClass25_1.<.ctor>b__3() at System.Lazy``1.ViaFactory(LazyThreadSafetyMode mode) at System.Lazy``1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) at System.Lazy``1.CreateValue() at LibGit2Sharp.Repository.get_Config() at LibGit2Sharp.Branch.RemoteNameFromLocalBranch() at LibGit2Sharp.Branch.get_RemoteName() at LibGit2Sharp.Commands.Pull(Repository repository, Signature merger, PullOptions options) at UniversalAutomation.Git.GitService.Pull() in C:\src\universal\src\UniversalAutomation.Git\GitService.cs:line 225 at UniversalAutomation.GitSyncService.TrySync() in C:\src\universal\src\UniversalAutomation\Services\GitSyncService.cs:line 83 at UniversalAutomation.GitSyncService.Sync() in C:\src\universal\src\UniversalAutomation\Services\GitSyncService.cs:line 54" (2d6ed692)

avatar

How are you running Universal? Service or something? It seems like file permissions may be incorrect now that you used the git commands manually…

Adam Driscoll

PowerShell Expert and Software Architect at Devolutions

avatar

As a service, yeah. Installed via the msi.

avatar
(anonymous user)

Resurrecting an old thread because we’ve just hit this same error message:

Git Synchronization Failed

There is no tracking information for the current branch

Our GitHub repo was a new, blank repo, and I was sure to add a setting Data__GitBranch = “main” to our environment variables.

When I drop to the repository folder in the Azure Kudu console and type “git status” I see this:

D:\home\data\PowerShellUniversal\Repository>git status

On branch master

No commits yet

Untracked files:

(use “git add …” to include in what will be committed)

.universal/

… (list of .ps1 files)

(Notice it says “On branch master”? Our GitHub repo doesn’t have a master branch.)

Does PSU not honour the Data__GitBranch environment variable? Do I need to add it to the appsettings.json file? Or is there something else I need to do to get it to clone and sync with “main”?

Cheers,

Matt