0

I just found out that from the 13th that support for password authentication was removed, and instead, I should use a personal access token. I generated the token and followed the steps in the link provided in the terminal but it still gives me some issues when I am trying to push. Does anyone know why?

[kinzluiz:...ch-7-object-oriented-design]$ git status                  (main✱) 
On branch main
Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    new file:   louis/.classpath
    new file:   louis/.gitignore
    new file:   louis/.project
    new file:   louis/src/deckofcards/BlackJack.java
    new file:   louis/src/deckofcards/Card.java
    new file:   louis/src/deckofcards/Deck.java
    new file:   louis/src/deckofcards/Suit.java
    new file:   louis/src/module-info.java

Changes not staged for commit:
  (use "git add/rm <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   ../ch2-linked-lists/Louis/linkedlistctci.py
    deleted:    ../ch2-linked-lists/Louis/main.py
    modified:   ../ch3-stacks-and-queues/louis/main.py

Untracked files:
  (use "git add <file>..." to include in what will be committed)
    ../ch1-arraysAndStrings/Louis/.gitignore
    ../ch3-stacks-and-queues/.idea/

[kinzluiz:...ch-7-object-oriented-design]$ git commit -m "deck of cards "                                                                                                                        (main✱) 
[main e6676a6] deck of cards
 8 files changed, 103 insertions(+)
 create mode 100644 ch-7-object-oriented-design/louis/.classpath
 create mode 100644 ch-7-object-oriented-design/louis/.gitignore
 create mode 100644 ch-7-object-oriented-design/louis/.project
 create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/BlackJack.java
 create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Card.java
 create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Deck.java
 create mode 100644 ch-7-object-oriented-design/louis/src/deckofcards/Suit.java
 create mode 100644 ch-7-object-oriented-design/louis/src/module-info.java
[kinzluiz:...ch-7-object-oriented-design]$ git push                                                                                                                                              (main✱) 
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: unable to access 'https://github.com/AisosaUtieyin/ctci.git/': The requested URL returned error: 403
Kinz Luiz
  • 13
  • 2
  • 2
    Does this answer your question? [Support for password authentication was removed. Please use a personal access token instead](https://stackoverflow.com/questions/68775869/support-for-password-authentication-was-removed-please-use-a-personal-access-to) – matt Aug 14 '21 at 13:20

1 Answers1

0

That could mean your old credential (password) is still stored in the Git credential helper.

Check the output of git config --global credential.helper: it could have cached another user/email/password.
If that setting is xxx, type:

printf "protocol=https\nhost=github.com"| git-credential-xxx get

By 'xxx', I mean "the output of the git config --global credential.helper".
Do not use 'xxx': replace it.

You will check if there is any credential already stored.
If it is:

printf "protocol=https\nhost=github.com"| git-credential-xxx erase

The next push will prompt for your new credentials (token).

For instance, if the output is: osxkeychain, type (Mac only):

printf "protocol=https\nhost=github.com"| git-credential-osxkeychain erase
# Or:
security delete-internet-password -l github.com

Both commands remove the github.com entry from your KeyChain.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • when i type git config --globa credential.helper it outputs osxkeychain – Kinz Luiz Aug 14 '21 at 13:51
  • and when i type printf "protocol=https\nhost=github.com"| git-credential-xxx get it says zsh: command not found: git-credential-xxx – Kinz Luiz Aug 14 '21 at 13:52
  • @KinzLuiz I meant: replace xxx by the output of your credential helper – VonC Aug 14 '21 at 13:55
  • it tells me this printf "protocol=https\nhost=github.com"| git-credential-oskeychain get zsh: command not found: git-credential-oskeychain(MY output was oskeychain) – Kinz Luiz Aug 14 '21 at 13:59
  • @KinzLuiz OK. How about `security delete-internet-password -l github.com`? – VonC Aug 14 '21 at 14:00