Search code examples
gitgit-pullgit-credential-managergit-authentication

`git pull --rebase origin dev xxxxx.git` require autentication


I want to push some software to 'dev' branch. Software was developed to another computer with Windows and currently I have reinitialize git repository from scratch on Linux machine and want to push my job to company repository and add my patch to previous dev branch

 git init
 git branch -M dev
 git remote add origin https://github.com/<company>/<repository>.git
 git add .
 git commit -m "first commit"
 git pull --rebase origin dev git@gitserv:<company>/<repository>.git

last command don't working and I don't understanding my trouble. Firstly I have Github key what looks as SHA256:CUxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Github key

Secondary I have "Personal access tokens (classic)" what we usually setting under point "Developer setting" and what look as ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Third, I have this ~/ssh/config

  Host gitserv
      HostName git.com
      IdentityFile ~/.ssh/id_rsa.github
      IdentitiesOnly yes 
      AddKeysToAgent yes

And, of course, I have ~/.ssh/id_rsa.github and ~/.ssh/id_rsa All looking fine, but last command

  git pull --rebase origin dev git@gitserv:<company>/<repository>.git

don't working, ask login/password and than said

  remote: Support for password authentication was removed on August 13, 2021.

I don't understand my mistake, what I doing wrong?


Solution

  • Firstly need to check what your account see github

      ssh -T [email protected]
    

    Than best way is generate new key pair

     ssh-keygen -t ed25519 -C "EMAIL-for-your-Github-login"
    

    and only than any other operation user speak in this topic - add your key to SSH key and than

     git remote add origin [email protected]:xxxxxx/yyyyyyyyy.git
     git push --force [email protected]:xxxxxx/yyyyyyyyy.git
    

    my current Github config

    Host github
       HostName github.com
       IdentityFile ~/.ssh/id_rsa
       IdentitiesOnly yes 
       AddKeysToAgent yes
    

    and mistake of other answer is omit first two step what is most important step
    this step can be omit only for extremely newbie and LOL user who has only one Github account. Of course, any real programmer use each account for any new project to prevent illegal tracing programmer's projects and activity.