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# 

 

git clone

git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

 

 上傳圖片

在編寫Github的Readme時常常需要添加圖片輔助說明。
首先,將需要的圖片保存在本地文件夾。
其次,將本地的圖片push到GitHub的遠程倉庫。
然后,在GitHub上打開圖片,得到圖片的url。
最后,在Readme中輸入如下格式的代碼:

![image](https://github.com/xxx/xxx/blob/master/xxx/xxx.png)

創建一個分支

1,從已有的分支創建新的分支(如從master分支),創建一個dev分支

Git checkout -b dev

2,創建完可以查看一下,分支已經切換到dev

git branch

    * dev

    master

3,提交該分支到遠程倉庫

git push origin dev

4,測試從遠程獲取dev

git pull origin dev

或者:

如果用命令行,運行 git fetch,可以將遠程分支信息獲取到本地,再運行 git checkout -b local-branchname origin/remote_branchname
就可以將遠程分支映射到本地命名為local-branchname 的一分支

 

 

root@ubuntu:~/tracingLK# git checkout -b dev1.0
Switched to a new branch 'dev1.0'
root@ubuntu:~/tracingLK# ssh-agent bash

root@ubuntu:~/tracingLK# git branch
* dev1.0
  main

root@ubuntu:~/tracingLK# git push origin dev1.0
Total 0 (delta 0), reused 0 (delta 0)
remote: 
remote: Create a pull request for 'dev1.0' on GitHub by visiting:
remote:      https://dev1.0
remote: 
To github.com:magnate3/tracingLK.git
 * [new branch]      dev1.0 -> dev1.0
root@ubuntu:~/tracingLK# git pull origin dev1.0
From github.com:magnate3/tracingLK
 * branch            dev1.0     -> FETCH_HEAD
Already up to date.
root@ubuntu:~/tracingLK# git branch
* dev1.0
  main
root@ubuntu:~/tracingLK# 

 

root@ubuntu:~/tracingLK/drivers# git push -u origin main
Branch 'main' set up to track remote branch 'main' from 'origin'.
Everything up-to-date
root@ubuntu:~/tracingLK/drivers# git branch
* dev1.0
  main
root@ubuntu:~/tracingLK/drivers# git push -u origin dev1.0
Counting objects: 16, done.
Delta compression using up to 64 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (16/16), 29.52 KiB | 3.69 MiB/s, done.
Total 16 (delta 0), reused 0 (delta 0)
To github.com:magnate3/tracingLK.git
   868d315..e25236b  dev1.0 -> dev1.0
Branch 'dev1.0' set up to track remote branch 'dev1.0' from 'origin'.

 

插入代碼片段

我們需要在代碼的上一行和下一行用` “ 標記。“` 不是三個單引號,而是數字1左邊,Tab鍵上面的鍵。要實現語法高亮那么只要在 “` 之后加上你的編程語言即可(忽略大小寫)。


 

git push -u origin main -f


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM