Wednesday 23 August 2017

Git 設定個人資訊

Preface

當使用 Git 進行版本控制時,完成 local commit 後,需要將 commit push 到 remote repository 的時候需要將個人的 profile 一同 push 到 remote repository 前,需要先設定個人的 profile。

Tutorial

可以透過下面兩行 command line 去進行設定 name 以及 email。
$git config user.name = "YOUR NAME"
$git config user.email = youreamil@yourdomain.com
當然也可透過 --global 選項進行全域變數的設定。
$git config --global user.name = "YOUR NAME"
最後可以使用 --list 進行所有的 config 設定
$git config --list
完成設定 profile 後以後 push commit 到 remote repository 的時候就會順便帶上個人的資訊了。如果是以 Github 為例, Github 會拿你所設定的 user.email 去跟帳號做連動。也就是 profile 上的 email 必須與你 Github 的帳號一致。此時 Github 才會把你每次 commit 的 code 列入 account activity 的計算。

0 comments:

Post a Comment