Trouble using external Git client

Product: PowerShell Universal
Version:3.3.1

Trying to get the external git client to work and I’m not sure where I am going wrong.

I installed git for windows from here

https://git-scm.com/

When on the server I can run git in the command line and it is recognized. I went into the repository folder and deleted the existing .git folder. I created a whole new project in my on prem GitLab instance and set up git like this with the PAT in the URL

when I click Synchronize Now it says Success, but nothing is committed to my git

I’m seeing this in the logs

2022-09-16 10:00:28.377 -04:00 [INF] Git repository does not exist. Initializing.
2022-09-16 10:00:32.168 -04:00 [ERR] Git Error: error: unknown switch `M'
usage: git checkout [<options>] <branch>
   or: git checkout [<options>] [<branch>] -- <file>...

    -b <branch>           create and checkout a new branch
    -B <branch>           create/reset and checkout a branch
    -l                    create reflog for new branch
    --guess               second guess 'git checkout <no-such-branch>' (default)
    --overlay             use overlay mode (default)
    -q, --quiet           suppress progress reporting
    --recurse-submodules[=<checkout>]
                          control recursive updating of submodules
    --progress            force progress reporting
    -m, --merge           perform a 3-way merge with the new branch
    --conflict <style>    conflict style (merge, diff3, or zdiff3)
    -d, --detach          detach HEAD at named commit
    -t, --track[=(direct|inherit)]
                          set branch tracking configuration
    -f, --force           force checkout (throw away local modifications)
    --orphan <new-branch>
                          new unparented branch
    --overwrite-ignore    update ignored files (default)
    --ignore-other-worktrees
                          do not check if another worktree is holding the given ref
    -2, --ours            checkout our version for unmerged files
    -3, --theirs          checkout their version for unmerged files
    -p, --patch           select hunks interactively
    --ignore-skip-worktree-bits
                          do not limit pathspecs to sparse entries only
    --pathspec-from-file <file>
                          read pathspec from file
    --pathspec-file-nul   with --pathspec-from-file, pathspec elements are separated with NUL character


2022-09-16 10:00:32.291 -04:00 [ERR] Git Error: git: 'git' is not a git command. See 'git --help'.

The most similar command is
	init

2022-09-16 10:00:32.291 -04:00 [INF] Starting sync...
2022-09-16 10:00:32.338 -04:00 [ERR] Git Error: error: pathspec 'Main' did not match any file(s) known to git

2022-09-16 10:00:32.380 -04:00 [ERR] Git Error: fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master

To have this happen automatically for branches without a tracking
upstream, see 'push.autoSetupRemote' in 'git help config'.


2022-09-16 10:00:32.593 -04:00 [INF] Latest commit Id: c862278a440ea35e9a97a1fe4a0377894565486b, Number of changes since last sync: 379
2022-09-16 10:00:32.594 -04:00 [INF] Sync done. Status Id: 91960

Saw that 3.3.2 fixed the M issue. Update to that, so Git sync says it has run and added files, but nothing shows up in my repository

I tried deleting the repository, creating a new one, and setting it back up using a PAT in the URL

https://USER:PAT-------@git.example.com/USER/universal.git

Same thing happens. The UI shows that git sync ran and files were added, but nothing appears in my repository

I modified one file and again, the logs show a single file updated, but nothing appears on my repo.

I think the casing may matter on the branch name. Do you happen to have a Main and main branch now?

Never mind, I see it says 1 branch. I would still give that a shot to see if the behavior is different.

During a push we run:

git checkout {branchname}
git push

Just tried that and it made no difference. Tried deleting the .git folder and resyncing, same result. The Universal UI shows files were added, but nothing appears in the repo.

Tried the whole process over again. Deleted and created new repo. Set up PAT. Deleted .git folder. Added URL and settings to Universal and ran a sync. Says it added files, but nothing shows up.

Can you please try this? Navigate to the repository directory and run this:

git push -u origin main

Next, make a change in your admin console and click the Synchronize Now button and see if files show up.

Ran that command and got an error

Added a comment to the Roles.ps1 and did another sync

Still nothing in the repo

Can you try running it directly in a PSU terminal? It seems like a permission thing.

Hmm. It’s giving an SSL cert issue

But the cert on that server is fine, I just updated it

image

EDIT:
tried running it again and got an error saying it doesn’t recognize git now

I found some info about the cert error here: Unable to resolve "unable to get local issuer certificate" using git on Windows with self-signed certificate - Stack Overflow

It might be possible that it’s not using schannel. There are also examples of how to trust the cert specifically.

This is a publicly signed cert from Godaddy, not internal. I followed the thread and changed the sslbackend to schannel. The SSL cert issue went away. I cleared the .git folder, deleted and created a fresh repo, set up a PAT, and got a credential error

found this issue thread about the problem

Changed the credential store that was used by adding credentialStore = dpapi to my git config

image

My repo is now populated and changes are being synced

Huzzah!

Awesome! I will try to collect some of this information so we can added it to our docs or a KB article.

I’ll also see what makes sense to get added directly into the product. Thanks for the patience and persistence and I’m glad it’s working.