No access to new repository with active ssh key on profile

Hey all - just joining this group. I am on Endeavour OS (Arch based) and using github for a while to contribute to existing projects. Using the terminal for all git tasks…

I am now in trouble again since the access to github is only available with access token or ssh key. When i created a new repository I cannot push to it - somehow the ssh key in my github profile is only recognized for existing repositories. I could yet again create another ssh key but there must be a smarter solution. Couldnt find any help yet in documentation or forum so asking here…

What I have done:

  • create new repository on my git site
  • git clone
  • changed to directory
  • made changes
  • git add --all
  • git commit -m "Initial commit"
  • git push -u origin main

now it doesn’t ask for the passphrase for the ssh key but instead for git username and password which doesnt work since summer

$ git push -u origin main
Username for '': toszlanyi
Password for '': 
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see for more information.
fatal: Authentifizierung fehlgeschlagen für ''
$ ssh -vT
OpenSSH_8.8p1, OpenSSL 1.1.1l  24 Aug 2021
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to [] port 22.
debug1: Connection established.
debug1: Offering public key: /home/osz/.ssh/id_ed25519 ED25519 SHA256: ...
debug1: Server accepts key: /home/osz/.ssh/id_ed25519 ED25519 SHA256: ...
Enter passphrase for key '/home/osz/.ssh/id_ed25519': 
Authenticated to ([]:22) using "publickey".
Hi toszlanyi! You've successfully authenticated, but GitHub does not provide shell access.
$ git remote -v
origin (fetch)
origin (push)
$ cat .git/config 
        repositoryformatversion = 0
        filemode = true
        bare = false
        logallrefupdates = true
[remote "origin"]
        url =
        fetch = +refs/heads/*:refs/remotes/origin/*
        pushurl =
[branch "main"]
        remote = origin
        merge = refs/heads/main

On my other own or cloned repositories I can push using the ssh key id_ed25519 that is set up correctly in my account settings. Any idea how to push / access the new xyz-repo?
Any help appreciated.

Anyone, who can explain what I missed? Thx.

Your repository is configured with an HTTPS remote URL, not SSH, that’s why it’s not using your SSH key. You can change the URL to SSH like this:

git remote set-url origin

For future reference, when you click the green “Code” button on the repository page you can select the protocol you want to use in the box that comes up to get the right URL.

Wicked! Thanks for pointing into the right direction. Your line only changes the fetch url though. But with option --push it also changes the other url.

git remote set-url --push origin
1 Like

Peculiar, in my experience it changes both unless you use one of the flags. I wonder if behavior changed between versions?