I'm trying to use The Godot Git plugin v3 with a Godot 4.0.4 project. (I'd prefer to use Godot 4.2, but the plugin is only compatible with 4.0.)

References for this plugin:
https://github.com/godotengine/godot-git-plugin/wiki/Git-plugin-v3
https://godotengine.org/asset-library/asset/1581
(v3 of the plugin is for Godot 4, v2 of the plugin is for Godot 3)

It works correctly with the local git repository, but fails to push commits to the remote github repository.

GitPlugin: Performing push to origin
core/variant/variant_utility.cpp:903 - GitPlugin: Could not connect to remote "origin". Are your credentials correct? Try using a PAT token (in case you are using Github) as your password. Error -1: too many redirects or authentication replays in godot-git-plugin/src/git_plugin.cpp:_push#L532

This is apparently a known issue:
https://github.com/godotengine/godot-git-plugin/issues/192

So I'm trying the workaround of using a shell command (outside of Godot) to push the local repository to the remote github repository. But I can't figure out how to do that.

I created an SSH key pair, and verified that the key works with github by using this shell command:
ssh -T git@github.com

If I try this shell command to do the push:
git push origin master git@github.com:USER_NAME/REPO_NAME.git

I get this error:

error: failed to push some refs to 'https://github.com/USER_NAME/REPO_NAME'

USER_NAME is replaced by my github username, and REPO_NAME is replaced by the github repository name. I previously created the repository on the github.com web site.

Why is the git push shell command not working? 😖

My goal is to make the remote repository the same as the local repository.

    It's been a long time since I did this, but I seem to remember that I wasn't allowed to make my own key pair. I had to use the temporary token to push to github. 😕

    DaveTheCoder error: failed to push some refs to 'https://github.com/USER_NAME/REPO_NAME'

    There are a few possible issues here. Is this all of the output that git push ... command gives? There should be more helpful info there.
    One probable problem could be that the remote and your local version have diverged, meaning that there are changes upstream that are not in the local version and vice-versa. You can verify that by trying git pull. If this is the case and you don't care about upstream changes (for example it's just the default README.md) you can do git push --force origin master ..., which should overwrite upstream changes with your local ones.
    Otherwise we would need more info to know what is the actual issue.

    I tried the --force option, but got the same result. Here's the full output:

    $ git push --force origin master git@github.com:USER_NAME/REPO_NAME.git

    error: src refspec git@github.com does not match any
    error: failed to push some refs to 'origin'

    11 days later

    DaveTheCoder fails to push commits to the remote github repository

    It started working, for two repositories (a Godot 3.5.3-rc1 project using v.2.1.0 of the plugin, and a Godot 4.0.4-stable project using v.3.0.0 of the plugin). I've been experimenting with git, but I don't recalling doing anything to fix this particular problem. 🤷