GIT setup not working

I seem to face some issues when trying to setup Git Sync with PSU

The message I have at the moment is:

Git synchronization failed. There is no tracking information for the current branch.

I have a Gitea container that serves as Git repository server
I have a appsettings.json in “.PowerShellUniversal” (copied from “/home/universal/appsettings.linux.json”)

appsettings.json content

"Data": {
    "RepositoryPath": "%HOME%/.PowerShellUniversal/Repository",
    "ConnectionString": "%HOME%/.PowerShellUniversal/database.db",
    "RunMigrations": true,
    "DatabaseType": "LiteDB",
    "GitRemote": "http://host.docker.internal:8089/steven/universal.git",
    "GitUserName": "steven@jikade.com",
    "GitPassword": "4O2WSiN7xk*0xLFo0r4G",
    "GitBranch": "main",
    "GitSyncBehavior": "TwoWay",
    "GitInitializeBehavior": "",
    "GitSyncInterval": "1",
    "ConfigurationScript": "",
    "ExternalGitClient": false,
    "Mode": "Manual"
  },

The UI settings in PSU:

From the PSU log:

[18:04:03 ERR] Failed to sync: There is no tracking information for the current branch.    at LibGit2Sharp.Commands.Pull(Repository repository, Signature merger, PullOptions options) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Commands\Pull.cs:line 29
   at UniversalAutomation.Git.GitService.Pull() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 614
   at UniversalAutomation.GitSyncService.TrySync(GitStatus status, Boolean force, GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 177
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 100

From the .git folder, the config file content:

[core]
	bare = false
	repositoryformatversion = 0
	filemode = true
	logallrefupdates = true
[remote "origin"]
	url = http://host.docker.internal:8089/steven/universal.git
[branch "main"]
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*

FYI:
The hostname “host.docker.internal” is an internal extra host to get the IP of the Docker host as that is a way to break out of the container and address another service on the Docker host in a container.
Anyway, that will resolve in the PSU container as the IP address of the Docker gateway.
For those wondering how in compose you would have that:

extra_hosts:
      - "host.docker.internal:host-gateway"

So my question is, what would be the correct setup?
From the perspective of PSU this is the information it should/could use to get at the Gitea server

Gitea runs:
Host: host.docker.internal
Port: 8089
SHH key: my personal key

When I clone the repository on my laptop with this command:
git clone http://192.168.2.192:8089/steven/universal.git

It works fine it seems, the repository is cloned

Note that the IP address is the address of the Docker host where Gitea is running on port 8089

I would also like to use SSH but perhaps that is not possible?

Any help with this Git setup in PSU would be appreciated!

Regards,
Steven

Product: PowerShell Universal
Version: 3.9.2

What’s the current status of the local git repository within the container? It seems like there is an existing git repo in the container and a remote that also has content. Is that correct?

PSU requires that either the local repository folder is completely empty or the remote is bare.

If you want to use SSH keys, you will need to configure git to use the external client. This requires the git command line be installed but allows for any configuration you desire via local git settings outside of PSU.

Hi Adam,
Thanks! I have some other issues atm and have to park the Git issue for now as investigation on that one takes a bit too much time and can wait. Not ideal but at the moment I have a big issue on running scripts/jobs in Environments 7.3.4 and if that blocks me then forget about Git :slight_smile:

The moment I pick this up I will give some feedback!