github ssh git push token

 

root@ubuntu:~/karmada/karmada_k8s# ssh-agent -s
SSH_AUTH_SOCK=/tmp/ssh-z9EBng6tTBt9/agent.2111159; export SSH_AUTH_SOCK;
SSH_AGENT_PID=2111160; export SSH_AGENT_PID;
echo Agent pid 2111160;
root@ubuntu:~/karmada/karmada_k8s# ssh-add ~/githubSsh/githubSsh
Could not open a connection to your authentication agent.
root@ubuntu:~/karmada/karmada_k8s# ssh-add -K  ~/githubSsh/githubSsh
Could not open a connection to your authentication agent.
root@ubuntu:~/karmada/karmada_k8s# ssh-agent bash
root@ubuntu:~/karmada/karmada_k8s# ssh-add -K  ~/githubSsh/githubSsh
unknown option -- K
usage: ssh-add [options] [file ...]
Options:
  -l          List fingerprints of all identities.
  -E hash     Specify hash algorithm used for fingerprints.
  -L          List public key parameters of all identities.
  -k          Load only keys and not certificates.
  -c          Require confirmation to sign using identities
  -t life     Set lifetime (in seconds) when adding identities.
  -d          Delete identity.
  -D          Delete all identities.
  -x          Lock agent.
  -X          Unlock agent.
  -s pkcs11   Add keys from PKCS#11 provider.
  -e pkcs11   Remove keys provided by PKCS#11 provider.
  -q          Be quiet after a successful operation.
root@ubuntu:~/karmada/karmada_k8s# ssh-add   ~/githubSsh/githubSsh
Enter passphrase for /root/githubSsh/githubSsh: 
Identity added: /root/githubSsh/githubSsh (/root/githubSsh/githubSsh)
root@ubuntu:~/karmada/karmada_k8s# 
root@ubuntu:~/karmada/karmada_k8s# ssh-add   ~/githubSsh/githubSsh
Enter passphrase for /root/githubSsh/githubSsh: 
Identity added: /root/githubSsh/githubSsh (/root/githubSsh/githubSsh)
root@ubuntu:~/karmada/karmada_k8s# git push -u origin main
Warning: Permanently added the RSA host key for IP address '52.74.223.119' to the list of known hosts.
Counting objects: 64, done.
Delta compression using up to 64 threads.
Compressing objects: 100% (63/63), done.
Writing objects: 100% (64/64), 30.78 KiB | 2.56 MiB/s, done.
Total 64 (delta 22), reused 0 (delta 0)
remote: Resolving deltas: 100% (22/22), done.
To github.com:magnate3/karmada_deploy.git
 * [new branch]      main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
root@ubuntu:~/karmada/karmada_k8s# 

每次git push都有添加秘钥

root@ubuntu:~/karmada/karmada_k8s# git push -u origin main
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
root@ubuntu:~/karmada/karmada_k8s# ssh-add   ~/githubSsh/githubSsh
Could not open a connection to your authentication agent.
root@ubuntu:~/karmada/karmada_k8s# ssh-agent bash
root@ubuntu:~/karmada/karmada_k8s# ssh-add -K  ~/githubSsh/githubSsh
unknown option -- K
usage: ssh-add [options] [file ...]
Options:
  -l          List fingerprints of all identities.
  -E hash     Specify hash algorithm used for fingerprints.
  -L          List public key parameters of all identities.
  -k          Load only keys and not certificates.
  -c          Require confirmation to sign using identities
  -t life     Set lifetime (in seconds) when adding identities.
  -d          Delete identity.
  -D          Delete all identities.
  -x          Lock agent.
  -X          Unlock agent.
  -s pkcs11   Add keys from PKCS#11 provider.
  -e pkcs11   Remove keys provided by PKCS#11 provider.
  -q          Be quiet after a successful operation.
root@ubuntu:~/karmada/karmada_k8s# ssh-add   ~/githubSsh/githubSsh
Enter passphrase for /root/githubSsh/githubSsh: 
Identity added: /root/githubSsh/githubSsh (/root/githubSsh/githubSsh)
root@ubuntu:~/karmada/karmada_k8s# git push -u origin main
Counting objects: 9, done.
Delta compression using up to 64 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (9/9), 1.18 KiB | 1.18 MiB/s, done.
Total 9 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 1 local object.
To github.com:magnate3/karmada_deploy.git
   40e36f4..48822d1  main -> main
Branch 'main' set up to track remote branch 'main' from 'origin'.
root@ubuntu:~/karmada/karmada_k8s# 
原文地址:https://www.cnblogs.com/dream397/p/15158145.html