Author Topic: Git push to Github issue.  (Read 3979 times)

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4658
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Git push to Github issue.
« on: December 23, 2023, 02:20:14 am »
Hello

Since Github changed to the doble autentification factor, or maybe earlier, I had not been able to "push" (upload) code changes to the github repository.

I get this issue:

Quote
[E:\DEV\5TRYING\DOCS-IDEAS-WARP-Martin-s-Docs]git push
Username for 'https://github.com':
Password for 'https://martiniturbide@github.com':
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/OS2World/DOCS-IDEAS-WARP-Martin-s-Docs/'

I'm lost with the documentation now. Does anybody know what I may be missing now ?

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4752
  • Karma: +96/-1
    • View Profile
Re: Git push to Github issue.
« Reply #1 on: December 23, 2023, 03:33:15 am »
I'm pushing with a private token, though doesn't work for OS2World, maybe due to setup error.
https://github.com/settings/tokens/ I believe. I'm also having to authenticate through my phone, the github app and/or an authenticator app, 2FAS Auth here, there's a few.
Just updated my token, they're good for a month and pushed to a fork of the screensaver. Once I'm ready, I'll sync them, which I seem to be able to do from the browser.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4658
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Git push to Github issue.
« Reply #2 on: December 23, 2023, 02:37:24 pm »
Hello

I'm not sure if I did the right thing now, for the OS2World organization in github I had set:
- Allow access via fine-grained personal access tokens
- Do not require administrator approval
- Allow access via personal access tokens (classic)

But I can not still push, using the github password, or using my personal token. Do I have to generate an token for OS2World ? I still have no idea where to put it when I run the git.exe command.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4752
  • Karma: +96/-1
    • View Profile
Re: Git push to Github issue.
« Reply #3 on: December 23, 2023, 04:03:23 pm »
Use the token like a password, paste it in when pushing and asked for a password. I use fc/2 and find a mouse cord for pasting works while shift-insert seems to add an extra something, probably an EOL and doesn't work.
It's possible you might have to generate one for OS2World.

Steven Levine

  • Newbie
  • *
  • Posts: 13
  • Karma: +4/-0
    • View Profile
Re: Git push to Github issue.
« Reply #4 on: December 24, 2023, 06:22:48 pm »
Martin, I guess it's been a while since you last pushed.  Tokens have been required for pushes for quite a while.

Your access control settings seem reasonable.  I'll have to check what I use.

The token is associated with the user id.  If you login as os2world, you need token for os2world. 
If you login as MartinI, you need a token for MartinI

There's no need to copy/paste tokens.  Use a credential helper

In %HOME\.gitconfig add:

[credential]

; helper = cache
helper = store
; helper = store --file d:/home/.git-credentials

Then create %HOME\.git-credentials

and insert the URL:

 https://your-name:token-goes-here@github.com

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4658
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: Git push to Github issue.
« Reply #5 on: December 29, 2023, 04:43:09 am »
Hello

I tried again today, but i got this error:

Quote
[E:\DEV\5TRYING\DOCS-IDEAS-WARP-MARTIN-S-DOCS]git push
remote: Permission to OS2World/DOCS-IDEAS-WARP-Martin-s-Docs.git denied to martiniturbide.
fatal: unable to access 'https://github.com/OS2World/DOCS-IDEAS-WARP-Martin-s-Do
cs/': The requested URL returned error: 403

OS2World is not an account, is an organization, my account is "martiniturbide".
I tried a "Fine-grained tokens" and also "Tokens (Classic)", but none work for the git push.

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Dave Yeo

  • Hero Member
  • *****
  • Posts: 4752
  • Karma: +96/-1
    • View Profile
Re: Git push to Github issue.
« Reply #6 on: December 29, 2023, 05:57:37 am »
One possible work around. Fork the repository under your account and clone it. Create a branch and check it out, do your work, commit it and push it. Then on your fork's web page create a pull request. Go to the OS2World page and accept the request and merge it in. Then sync your fork.
Haven't fully tested, I did seem to have the privileges to accept a pull request on OS2World.
If nothing else, it would be a learning experience.

Steven Levine

  • Newbie
  • *
  • Posts: 13
  • Karma: +4/-0
    • View Profile
Re: Git push to Github issue.
« Reply #7 on: December 29, 2023, 09:17:05 am »
403 means you probably still have an authentication issue.  I would suspect a push URL issue.  The rules have changed over the years.  For example, the git: scheme is no longer allowed.  The same is true for plain http:.

Check the push URL defined in the repo's config file (i.e.  .git\config)

These days, I usually use something like:

  url = https://StevenLevine@github.com/StevenLevine/php-os2.git

There's rarely a need for a specific pushurl.

Can you push to any repo?

A git push --dry-run to your repo fails here as expected.  I have a known good token, but no permission to push to the repo.

FWIW, I maintain a sandbox repo for working out these kinds of issues.  I can tune the access permissions without messing with the production repos.