smanders / externpro

build external projects with cmake
MIT License
13 stars 12 forks source link

git fetch fails with git protocol #342

Closed smanders closed 2 years ago

smanders commented 2 years ago

with XP_STEP=mkpatch all git fetch commands fail

Fetching origin
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
error: Could not fetch origin

from https://github.blog/2021-09-01-improving-git-protocol-security-github/

No more unauthenticated Git On the Git protocol side, unencrypted git:// offers no integrity or authentication, making it subject to tampering. We expect very few people are still using this protocol, especially given that you can’t push (it’s read-only on GitHub). We’ll be disabling support for this protocol.

...

Git protocol troubleshooting If you’re having trouble cloning a repository, make sure the URL starts with ssh://, https://, or git@github.com.

For existing repositories, if you’re having trouble fetching, check that the remote you are fetching from is an ssh:// or https:// URL, or an SSH pseudo-URL starting with git@github.com. You can run git remote -v in the repository to see the URLs for all remotes. If any of them start with git://, you should change the URL to a supported format.

smanders commented 2 years ago

after switching the protocol from git:// to https:// in the projects/*.cmake files of externpro and running make (with XP_STEP=mkpatch...

Cloning into 'wxx_repo'...
Switched to a new branch 'xpro'
Branch 'xpro' set up to track remote branch 'xpro' from 'origin'.
Submodule 'wxTLC' (git://github.com/smanders/wxTLC) registered for path 'wxTLC'
Submodule 'wxplotctrl' (git://github.com/smanders/wxplotctrl.git) registered for path 'wxplotctrl'
Submodule 'wxthings' (git://github.com/smanders/wxthings.git) registered for path 'wxthings'
Cloning into '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxTLC'...
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
fatal: clone of 'git://github.com/smanders/wxTLC' into submodule path '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxTLC' failed
Failed to clone 'wxTLC'. Retry scheduled
Cloning into '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxplotctrl'...
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
fatal: clone of 'git://github.com/smanders/wxplotctrl.git' into submodule path '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxplotctrl' failed
Failed to clone 'wxplotctrl'. Retry scheduled
Cloning into '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxthings'...
fatal: remote error:
  The unauthenticated git protocol on port 9418 is no longer supported.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
fatal: clone of 'git://github.com/smanders/wxthings.git' into submodule path '/bpvol/externpro/_bldrepo/xpbase/Source/wxx_repo/wxthings' failed
Failed to clone 'wxthings'. Retry scheduled

projects like wxx which have submodules will need to have an updated .gitmodules file, switching the protocol there from git:// to https://

smanders commented 2 years ago

when trying to push the change (to the .gitmodules file) to the wxx repo, where the origin is now using https:// protocol

smanders@bluepill:~/src/externpro/_bldrepo/xpbase/Source/wxx_repo$ git push smanders xpro
Username for 'https://github.com': smanders
Password for 'https://smanders@github.com':
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/smanders/wxx.git/'

https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

For developers, if you are using a password to authenticate Git operations with GitHub.com today, you must begin using a personal access token over HTTPS (recommended)

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

it's a rabbit hole... you can also "use GitHub CLI to authenticate GitHub on the command line and skip generating a personal access token and authenticate via the web browser instead." https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git

I've decided to use https:// like I was using the read-only git://... and if I need to push a change I set up another remote using the git@github.com protocol

smanders commented 2 years ago

.gitmodule changes can't be in the patches! the build fails with these changes because it's trying to patch a file that doesn't exist at build time when we don't use git repos and build from source tarballs/zip files

for example

[  7%] Performing patch step for 'wxx'
can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/.gitmodules b/.gitmodules
|index 8eb6dba..fa94cc1 100644
|--- a/.gitmodules
|+++ b/.gitmodules
--------------------------
smanders commented 2 years ago

completed with commits referenced above

verified