Logo10.10.67.130 
  News  Recent  Stats  Forums  Discord  GitHub  Contact
  Menu
 Username

 Password


   Register here

 Main menu
   BBCode test
 
 Content
   List Content
   Using GitHub
 
 Projects
   All projects

Using git with GitHub when 2FA is on

Why your password doesn't work

GitHub stopped accepting account passwords for git on 13 August 2021. On your AmigaOS 4 computer, git logs in over HTTPS with a personal access token instead: a long random string that takes the password's place. 2FA changes nothing in git; you type your 2FA code only on github.com, when you create the token.

Public repositories clone with no login. The token is needed to clone private repositories (such as the OpenAmiga-org ones) and to push.

This guide is for the git 2.45 port for AmigaOS 4.1 Update 3 (git_installer.lha on OS4Depot). SSH keys and the gh tool, the usual choices on Linux, macOS and Windows, need programs AmigaOS 4 doesn't have. The AmigaOS details below come from the port's source code (afxgroup/git); they haven't been tried on a real Amiga yet.

Step 1: Make a token (on any computer with a browser)

Tick two boxes, repo and workflow, and leave every other box empty. The rest of the list is for other tools, not for git.

Quickest way: while logged in to GitHub, open this link to the token form. It opens the form with the name filled in and the two boxes already ticked. Then go straight to point 3 below.

The long way to the same form:

  1. On github.com, click your picture (top right) â Settings.
  2. In the left column, at the very bottom: Developer settings â Personal access tokens â Tokens (classic). Then click Generate new token â Generate new token (classic). GitHub may ask for your password and 2FA code first.
  3. Fill in the form as in the table below, then click the green Generate token button at the bottom of the page.
  4. The next page shows the token, once. It starts with ghp_ and is 40 characters long. Copy it right away into a text file and move that file to the Amiga (USB stick, network share), so you can paste the token there instead of typing it. If you lose it, delete the token on the same page and make a new one.
On the formWhat to do
NoteAny name you will recognise, e.g. Amiga git
Expiration90 days, or No expiration if you would rather not renew it (GitHub shows a warning but allows it). GitHub emails you before a token expires.
repoTick it. Its five sub-boxes (repo:status, public_repo and so on) tick themselves. This is what lets git read and push your repositories, private ones included.
workflowTick it. Git needs it only when you push changes to files in .github/workflows (GitHub Actions); otherwise it does nothing.
Every other box (write:packages, admin:org, gist, user â¦)Leave them all empty

This one token works for both your own repositories and the OpenAmiga-org ones. GitHub also offers fine-grained tokens, but those ask for many more choices per repository, so this guide uses a classic one.

Step 2: Give the token to git on the Amiga

One setting makes git add your username and token to every github.com address it uses, so it never asks for a login. Type it once in a Shell, with your token in place of TOKEN (paste it with right Amiga + V):

git config --global "url.https://orgin:TOKEN@github.com/.insteadOf" "https://github.com/"

Git saves this in GIT:.gitconfig: this port keeps its global settings there, not in a home folder. git config --global --list shows what is set.

When a token expires, open GIT:.gitconfig in a text editor (such as NotePad) and replace the old token in its [url â¦] line.

The token is stored as plain text, like any saved login on AmigaOS, so keep GIT:.gitconfig out of backups you share. git remote -v shows it too.

Why not git's usual credential helper (credential.helper store)? This port starts helpers through /bin/sh, which AmigaOS turns into bin:sh, a program most AmigaOS systems don't have. The setting above needs no helper.

Step 3: Set your name, then clone

Tell git who you are, once. If your email is private on GitHub, use the noreply address shown at Settings â Emails (it ends in @users.noreply.github.com), or GitHub may refuse your pushes:

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Then clone with the plain HTTPS address from the repository page (green Code button â HTTPS); the rule from step 2 adds the token. The clone goes into a new drawer named after the repository, here Work:Filer:

CD Work:
git clone https://github.com/OpenAmiga-org/Filer.git

If git asks for a username, the address didn't match the rule from step 2: compare the two with git config --global --list.

Everyday commands

Run these in a Shell inside the clone's drawer (CD Work:Filer). They are the same as git on any other system.

TaskCommand
Clone into a drawer you namegit clone https://github.com/OpenAmiga-org/Filer.git Filer-test
Clone and check out one branchgit clone -b <branch> https://github.com/orgin/sftp-handler.git
See what changedgit status
Fetch and merge the latest changesgit pull
Record your changesgit add -A then git commit -m "What changed"
Send them to GitHubgit push
Show which address a clone usesgit remote -v
Fix an old clone with a password or old token in its addressgit remote set-url origin https://github.com/OpenAmiga-org/Filer.git

Give every commit its message with -m: without it git tries to start a text editor, which you would first have to name in the GIT_EDITOR variable.

The port's own notes list its limits: it is slower than git on modern systems, file names that differ only in case collide (AmigaOS ignores case), and non-ASCII file names can misbehave.

Troubleshooting

Most failures mean git used no token, a wrong token, or a token that can't reach that repository.

Message containsCauseFix
Support for password authentication was removedGit sent your account passwordUse a token (steps 1 and 2)
Invalid username or token / Authentication failedToken wrong, expired or revokedMake a new token and put it in GIT:.gitconfig
Git asks for a usernameThe address didn't match your rule from step 2Compare git remote -v with git config --global --list
Repository not found (but it exists)Your token can't see that private repositoryCheck that repo is ticked on the token. For OpenAmiga-org, check that you are a member and that the organization allows classic tokens (organization Settings â Personal access tokens)
Permission to ⦠denied to orgin / error: 403 on pushThe token lacks repoTick repo on the token (see below)
refusing to allow a Personal Access Token to create or update workflowThe token lacks workflowTick workflow on the token (see below)
GH007: Your push would publish a private email addressuser.email is your private addressSet it to the noreply address (step 3), then git commit --amend --reset-author
SSL certificate problemGit can't find its certificate listCheck that GIT:curl-ca-bundle.crt exists, then git config --global http.sslCAInfo GIT:curl-ca-bundle.crt

To tick a box on a token you already have: Settings â Developer settings â Personal access tokens â Tokens (classic) â click the token's name â tick the box â Update token. The token itself stays the same, so nothing changes on the Amiga.

For more detail, run SetEnv GIT_TRACE 1 before the failing command; UnSetEnv GIT_TRACE turns it off again.

Open Amiga project website, Created in 2008 by Björn Hagström