天天看點

git常見用法

使用gitlab

(1)删除已有的公鑰

git常見用法

使用指令:ssh-keygen.exe

私鑰預設路徑:/c/users/admin/.ssh/id_rsa

執行結果:

$ ssh-keygen.exe

generating public/private rsa key pair.

enter file in which to save the key (/c/users/admin/.ssh/id_rsa):

enter passphrase (empty for no passphrase):

enter same passphrase again:

your identification has been saved in /c/users/admin/.ssh/id_rsa.

your public key has been saved in /c/users/admin/.ssh/id_rsa.pub.

the key fingerprint is:

31:87:7e:23:33:8f:70:61:c9:29:66:a4:7e:2c:db:98 admin@admin-pc

the key's randomart image is:

+--[ rsa 2048]----+

|      .          |

|     o . +       |

|    . + x .      |

|   . + + =       |

|    o + s o      |

|     b o b .     |

|    e . . .      |

|                 |

+-----------------+

git常見用法

生成的公私玥:

git常見用法

 其中,id_rsa.pub 是公鑰,需要拷貝id_rsa.pub内容到github中

git常見用法

 把上述内容拷貝到github中,如下圖

git常見用法

注意:内容後面不能有空格和換行.

添加成功:

git常見用法

 這樣就可以使用git bash直接clone 代碼庫勒.

使用指令:git clone [email protected]:aaa/bb_web.git

git常見用法

檢視分支:

git branch -r

git常見用法

檢出指定分支

git checkout origin/dev_revert_online

git常見用法

送出修改的檔案(commit)

第一次送出時失敗

git常見用法

解決方法:

先執行:git config --global user.email "[email protected]"

git常見用法

 然後就送出成功了

git常見用法

檢視最後一個commit了的檔案

git log -n 1

git常見用法

送出流程

git add index.html

git commit -m "test" *

git push

git常見用法

$ git checkout

your branch is up-to-date with 'origin/master-bug'.