Unable to run workflow on Private/Internal repository

Hello,

I have a Gitea Repository that is set to private. Now I want to run gitea workflow so I can deploy an app but each time I want to run the workflow I get a fatal: unable to access 'https://[url]/[user]/[repository]/': The requested URL returned error: 403

Here is my Gitea Workflow yml

name: Test 
on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4

This is the log for checkout

::add-matcher::/run/act/actions/actions-checkout@v4/dist/problem-matcher.json
Syncing repository: [user]/[repository]
::group::Getting Git version info
Working directory is '/workspace/[user]/[repository]'
[command]/usr/bin/git version
git version 2.43.2
::endgroup::
Deleting the contents of '/workspace/[user]/[repository]'
::group::Initializing the repository
[command]/usr/bin/git init /workspace/[user]/[repository]
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint: 
hint: 	git config --global init.defaultBranch <name>
hint: 
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint: 
hint: 	git branch -m <name>
Initialized empty Git repository in /workspace/[user]/[repository]/.git/
[command]/usr/bin/git remote add origin https://[url]/[user]/[repository]
::endgroup::
::group::Disabling automatic garbage collection
[command]/usr/bin/git config --local gc.auto 0
::endgroup::
::group::Setting up auth
[command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
[command]/usr/bin/git config --local --name-only --get-regexp http\.https\:\/\/gitea\.***\.com\/\.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http\.https\:\/\/gitea\.***\.com\/\.extraheader' && git config --local --unset-all 'http.https://[url]/.extraheader' || :"
[command]/usr/bin/git config --local http.https://[url]/.extraheader AUTHORIZATION: basic ***
::endgroup::
::group::Fetching the repository
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +a9eee5316026e471259bf372f5f50e1d79f3711b:refs/remotes/origin/main
remote: Interacting with repositories by HTTP protocol is not allowed
fatal: unable to access 'https://[url]/[user]/[repository]/': The requested URL returned error: 403
The process '/usr/bin/git' failed with exit code 128
Waiting 13 seconds before trying again
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +a9eee5316026e471259bf372f5f50e1d79f3711b:refs/remotes/origin/main
remote: Interacting with repositories by HTTP protocol is not allowed
fatal: unable to access 'https://[url]/[user]/[repository]/': The requested URL returned error: 403
The process '/usr/bin/git' failed with exit code 128
Waiting 18 seconds before trying again
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +a9eee5316026e471259bf372f5f50e1d79f3711b:refs/remotes/origin/main
remote: Interacting with repositories by HTTP protocol is not allowed
fatal: unable to access 'https://[url]/[user]/[repository]/': The requested URL returned error: 403
::remove-matcher owner=checkout-git::
::error::The process '/usr/bin/git' failed with exit code 128

What do I have to do, so that workflow can checkout the gitea repository? Do I have to add an ssh-key into the secret?

I have enabled disable_http_git and tried with a token and it worked. But I want to use an ssh key for it. When I used an ssh key it failed to clone the repository.

Here is the log:

[command]/usr/bin/git config --local http.https://[url]/.extraheader AUTHORIZATION: basic ***
::endgroup::
::group::Fetching the repository
[command]/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --no-recurse-submodules --depth=1 origin +26c856e98dba0078bf6ecc98aba8e670f926d213:refs/remotes/origin/main
No ED25519 host key is known for [url] and you have requested strict checking.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The process '/usr/bin/git' failed with exit code 128

I’ve added the ssh-key under Profile > Settings > SSH-Key, added the private key as a secret and it still failed

What i would do is debug it from the runner

    runs-on: ubuntu-22.04
    container:
      image: PULL-HERE-AN-PUB-IMAGE

...

    steps:

      - name: Debug
        shell: bash
        run: |
          sleep 3600

Hop onto the runner container and try to debug the git clone from there.

I am also using

      - name: Checkout
        uses: actions/checkout@v4

Also repo is private, but being cloned from https://.

EDIT

there is a lot of config related to ssh keys in

are you using those ?