GitHub


 

1.首先下載 gitbash for win (https://gitforwindows.org/),並安裝

 

2.bash操作如下(bash命令行操作)(完全複製我自己執行的bash)

 

7413@PC2124 MINGW64 ~

$ ssh-keygen -t rsa -C "[email protected]           ###此處輸入(第一步)
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/7413/.ssh/id_rsa):   ####ras提示證書文件儲存處,接下來到第二步
Created directory '/c/Users/7413/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/7413/.ssh/id_rsa.
Your public key has been saved in /c/Users/7413/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:b2bxa7jjs9TeMhWKqrhdjS7XkXW4SFYleXEbV0k+ql0 [email protected]
The key's randomart image is:
+---[RSA 2048]----+
|            .o++*|
|            o.oo+|
|           . o + |
|          o o + .|
|        So.= = E |
|         +=+= o  |
|        ooB+oo   |
|     o.oo==.+o   |
|    o.o+..+*oo.  |
+----[SHA256]-----+

(在此期間把密鑰文件中的密鑰全部複製,到網站setting 中 ssh中創建新的密鑰,名字隨意,粘貼密鑰進去,保存)

 

 

 

 

 

7413@PC2124 MINGW64 ~

$ ssh -T [email protected]       #########確認密鑰是否建立(第二步
The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? y  (第三步,此處輸入yes,輸入y,會繼續提示輸入yes,確認保持連接)
Please type 'yes' or 'no': yes 
Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
Hi ChenShisen! You've successfully authenticated, but GitHub does not provide shell access.    ###成功提示


7413@PC2124 MINGW64 ~
$ git config --global user.name "ChenShisen"     ####輸入用戶名(第四步)


7413@PC2124 MINGW64 ~
$ git config --global user.email "[email protected]"  ######輸入郵箱(第五步)


7413@PC2124 MINGW64 ~
$ cd D/gitcode                                 ####進入本地倉庫,gitcode是在本地建的文件夾,即本地git倉庫根文件(第六步)

7413@PC2124 MINGW64 /D/gitcode
$ git clone https://github.com/ChenShisen/test.git     #####克隆git中的代碼倉庫到本地倉庫(第七步)
Cloning into 'test'...
warning: You appear to have cloned an empty repository.


7413@PC2124 MINGW64 /D/gitcode
$ ls                                ##看克隆是否成功,查看文件夾(第八步)
test/


7413@PC2124 MINGW64 /D/gitcode/test (master)
$ git add testfile                             #添加本地的文件到雲端(第九步)

7413@PC2124 MINGW64 /D/gitcode/test (master)
$ git commit -m "hahahahhahah"      #####提交 + ”備註**可省略備註“(第十步)
[master (root-commit) 3911329] hahahahhahah
 1 file changed, 1 insertion(+)
 create mode 100644 testfile/hahahh.txt


7413@PC2124 MINGW64 /D/gitcode/test (master)
$ git push origin master              ########確認提交(這步提交後,會出現登陸GitHub的窗口,輸入賬號163.com,密碼54321)(第十一步)
Counting objects: 4, done.
Writing objects: 100% (4/4), 257 bytes | 257.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0)
To https://github.com/ChenShisen/test.git
 * [new branch]      master -> master

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章