-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_LabSteps_GitHub.txt
More file actions
141 lines (63 loc) · 3.52 KB
/
_LabSteps_GitHub.txt
File metadata and controls
141 lines (63 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# Git 與 GitHub
1. 在 GitHub 建立一個新的 repository (數據庫)
1.1 登入 http://github.com
1.2 建立一個新的 repository (數據庫),設定如下:
Repository name: projectD
勾選: Initialize this repository with a README
<Note> 請記得勾選 Initialize this repository with a README
2. 複製遠端 GitHub 數據庫到 Cloud9 工作環境(近端)
2.1 回到 Cloud9 工作環境,
功能表 Window | New Terminal 新增一個終端機視窗
2.2 在終端機視窗輸入下列指令,複製遠端數據庫到 Cloud9 工作環境
git clone http://github.com/你的GitHub帳號/projectD
例如:
git clone http://github.com/AppDev1226/projectD
2.2 在終端機視窗輸入下列指令,切換到 projectD 資料夾:
cd projectD
<Note> 請留意資料夾名稱有區分大小寫。
2.3 在終端機視窗輸入下列指令,觀察 origin 是否在清單之列:
git remote -v
3. 新增/修改檔案,上傳回 GitHub
3.1 滑鼠點兩下 README.md,隨意加一些新內容並且存檔。
3.2 在 projectD 資料夾新建一個檔案,檔名: cars.txt,內容如下:
Mazda RX7-FC3S
<Note> 上述兩個檔案請記得存檔。
3.3 將 READMD.md 與 cars.txt 加入近端的數據庫(repository)。
指令如下:
git add .
git commit -m "update readme, add car list"
<Note> 重新整理 GitHub 網頁,檢視 README.md 是否出現變化。
3.4 將近端的數據庫(repository)上傳到 GitHub,
指令如下:
git push
<Note> Username 與 Password 請輸入你 GitHub 的帳號與密碼
<Note> 輸入密碼時,游標不會動是正常現象
<Note> 重新整理 GitHub 網頁,檢視 README.md 是否出現變化。
3.5 請問: GitHub 網站是在哪一個步驟之後才顯現出檔案有變化?
4. 提取 GitHub 的內容到 Cloud9 工作環境
4.1 在 GitHub 網站,針對 README.md,隨意加一些新內容並且存檔。
<Hint> 點一下 README.md,
再點按「Edit this file」(圖案為筆的那個按鈕)
4.2 在 Cloud9 終端機視窗輸入 git pull 指令
4.3 在 Cloud9 工作環境 projectD 資料夾的 README.md 檔案內容是否有變?
5. 解決遠端與近端版本衝突問題
5.1 在 GitHub 網站,針對 cars.txt 附加下列這行並且存檔:
TOYOTA TURENO GT-APEX(AE86)
5.2 在 Cloud9 工作環境,針對 cars.txt 附加下列這行並且存檔:
MazdaEfiniRX-7(FD-3S)
5.3 在 Cloud9 終端機視窗輸入下列指令,將檔案存入近端數據庫:
git add .
git commit -m "add FD-3S to car list"
<Note> 好了,現在兩地的版本有衝突了
5.4 在 Cloud9 終端機視窗輸入 git push 指令。
<Note> 結果是錯誤訊息,指出內容發生版本衝突問題,無法上傳。
5.5 在 Cloud9 終端機視窗輸入 git pull 指令。
<Note> 雖然 GitHub 遠端的內容的確下載回來了,
但畫面仍然出現一堆訊息,指出內容發生版本衝突。
<Note> Cloud9 終端機視窗的提示字元變成 (master|MERGING) $
5.6 滑鼠點兩下 cars.txt,選擇「Use Both」,將兩部車的名稱都保留下來。
5.6 解決衝突之後,重新再 commit 一次,指令如下:
git add .
git commit -m "keep two cars"
<Note> Cloud9 終端機視窗的提示字元變回 $
5.7 再次輸入 git push 指令上傳數據庫。