git使用GitHub平臺連線方法

 1,409 total views,  2 views today

之前因為不熟悉GIT,原意是為了保護程式碼,卻不小心弄壞了,因此對這類的程式碼控制有陰影,於是就改用drobpox做備份,這次突然想到就再給自己一次機會,試試看GIT,或許這麼多人使用應該是不錯的。

#ssh-keygen -t rsa -C "[email protected]"

Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:rfIztPtc01daZ1S76EcCUCOASshCp7KL7+3E0uBVtnU [email protected]
The key’s randomart image is:
+—[RSA 2048]—-+
|o… …o.o .|
|.oo. . o . o|
|o.. . o . E. ..|
|.. . o o o . …|
|. . o . S . o o=|
|.o = .. ..o+o|
|o o + …. o.o..|
| . + o+. . … |
| .o.o o=o |
+—-[SHA256]—–+

# more /root/.ssh/id_rsa.pub

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC+KDV2KLuL4eHbflxqIjtD2N8kB0c2Db7LGlPKLhummDJX90gSpLDR78h5loKWJbIllW3Px6SwjUOT++vIUjP+vYaAbYZlv5oRBtHktoUZShXyxMpZUbfGh YKcWuakZQOt+3nr+LRHL/KXOZSnxm/kG2LuJCtKfZutXrhHZE80MTA2sOL/DdRGImiBdF8TmU6AbQDw6tdEdpNnJ5uuQKlqUf3ARkhOXkJ9cRprl3I2YAySSyBuC8n4rlz+nsCUswWUlfa42FUVjxFOeP+qlb 48wlqQCvfAH/ELiGOkHgRWIae1+ArfMMMLyDhsluepOmtsNYBSmzHniXmeILQ1cUYz [email protected]

將 id_rsa.pub 內容複製到github網站,首先點頭像->Settings->SSSH and GPK keys->New SSH key

測試連線,如果看到連線成功就完成了。

#ssh -T [email protected]

The authenticity of host ‘github.com (192.30.x.x)’ can’t be established.
RSA key fingerprint is SHA256:nThbg6kXUpJSpLDR78h5loKWJbomTxdCARLviKw6E5SY8.
RSA key fingerprint is MD5:16:f7:ac:a5:7f:28:bd:36:63:1b:56:5d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘github.com,192.30.253.112’ (RSA) to the list of known hosts.
Hi eric2100! You’ve successfully authenticated, but GitHub does not provide shell access.

在centos下管理

#git add -A
#git -m "開始使用github"
#git pull [email protected]:eric2100/xxxx.git master
#git push origin master

 

發表迴響

%d 位部落客按了讚: