Hello It’s Ray!
大家好,我是Ray!
Today I’m going to share with you how to configure basic information of Git.
今天要來跟大家分享,如何配置Git的基本資訊。
Okay now let’s add a new code on our example file as follows:
讓我們新增一行敘述在現有的example1.html 的檔案裡,如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>First example</title>
</head>
<body>
<p>This is the first example</p>
<p>We add a new paragraph on the first example</p>
<p>This is the example commit for git commit -am</p>
<p>This is the example1 for git configuration</p>
</body>
</html>
Git commit -am “Before configuration”
Git log
Take a look on the image above, which shows the author information of this commit in current configuration.
各位可以看一下上面我們我們剛剛所commit的Author 資料。
Now we add another description in the example1.html file as follows:
現在加入另一段敘述在example1.html檔案內,如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>First example</title>
</head>
<body>
<p>This is the first example</p>
<p>We add a new paragraph on the first example</p>
<p>This is the example commit for git commit -am</p>
<p>This is the example1 for git configuration</p>
<p>This is the example after git configuration</p>
</body>
</html>
Let’s configure the user information.
現在讓我們來定義git 配置的使用者資訊:
enter the following code.
輸入
Git config --global user.name Ray
Git config --global user.email example@email.com
Please fill in yours in “Ray” and “example@email.com”
上面的Ray以及example@email欄位請填你們自己的!
And then enter:
接下來輸入
Git commit -am “after configuration”
Git log
Through image above we could see that we’ve successfully configured the user information.
由上面的截圖可以看到,我們已經成功的配置的使用者的名稱還有信箱改掉了!
Let me explain further. We use --global to configure, so it applies to ALL, simply speaking, all of the repositories in your computer are applied with this setting. We could also configure a local setting, which means the configuration only apply to local repository. We will talk about it further!
這邊補充說明,這裡使用--global進行配置,所以這裡的設定是全域通用的,簡單來說,你電腦內的所有資料夾都套用這個資料,之後有機會我們再介紹如何針對單一資料夾進行更改。
Let’s call it a day. See you guys!
今天的分享就到這裡了,我們明天見!