-
Notifications
You must be signed in to change notification settings - Fork 38
Expand file tree
/
Copy pathTutorial_180629_Git_with_constitution.html
More file actions
1016 lines (516 loc) · 43.6 KB
/
Tutorial_180629_Git_with_constitution.html
File metadata and controls
1016 lines (516 loc) · 43.6 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE HTML>
<html lang="" >
<head>
<meta charset="UTF-8">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>헌법개정안으로 깃베쉬, 소스트리, 브랜치 이해하기 · GitBook</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="description" content="">
<meta name="generator" content="GitBook 3.2.3">
<link rel="stylesheet" href="gitbook/style.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
<link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
<meta name="HandheldFriendly" content="true"/>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
<link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">
<link rel="next" href="Tutorial_180629_Github_practice_Statistics1.html" />
<link rel="prev" href="Tutorial_180628_Git_and_Github.html" />
</head>
<body>
<div class="book">
<div class="book-summary">
<div id="book-search-input" role="search">
<input type="text" placeholder="Type to search" />
</div>
<nav role="navigation">
<ul class="summary">
<li class="chapter " data-level="1.1" data-path="./">
<a href="./">
Introduction
</a>
</li>
<li class="chapter " data-level="1.2" data-path="Tutorial_180628_Git_and_Github.html">
<a href="Tutorial_180628_Git_and_Github.html">
Git과 Github, 기본 개념과 설명
</a>
</li>
<li class="chapter active" data-level="1.3" data-path="Tutorial_180629_Git_with_constitution.html">
<a href="Tutorial_180629_Git_with_constitution.html">
헌법개정안으로 깃베쉬, 소스트리, 브랜치 이해하기
</a>
</li>
<li class="chapter " data-level="1.4" data-path="Tutorial_180629_Github_practice_Statistics1.html">
<a href="Tutorial_180629_Github_practice_Statistics1.html">
확률통계 기초와 깃허브 실습
</a>
</li>
<li class="chapter " data-level="1.5" data-path="Tutorial_180629_Statistics.html">
<a href="Tutorial_180629_Statistics.html">
통계 기본 개념과 설명
</a>
</li>
<li class="chapter " data-level="1.6" data-path="Tutorial_180702_Programming_Intro.html">
<a href="Tutorial_180702_Programming_Intro.html">
스크래치 실습을 통한 프로그래밍 맛보기
</a>
</li>
<li class="chapter " data-level="1.7" data-path="Tutorial_180702_tidydata.html">
<a href="Tutorial_180702_tidydata.html">
데이터다루기(tidydata)와 프로그래밍기초
</a>
</li>
<li class="chapter " data-level="1.8" data-path="Tutorial_180703_Python_introduction.html">
<a href="Tutorial_180703_Python_introduction.html">
파이썬 기초
</a>
</li>
<li class="chapter " data-level="1.9" data-path="Tutorial_180705_PythonReview_Lamda.html">
<a href="Tutorial_180705_PythonReview_Lamda.html">
범죄데이터로 파이썬 실습 (Lamda)
</a>
</li>
<li class="chapter " data-level="1.10" data-path="Tutorial_180705_Resume_01.html">
<a href="Tutorial_180705_Resume_01.html">
특강-자기소개서 워크숍(1)
</a>
</li>
<li class="chapter " data-level="1.11" data-path="Tutorial_180706_Civic_hacking_seminar.html">
<a href="Tutorial_180706_Civic_hacking_seminar.html">
특강-시빅해킹
</a>
</li>
<li class="chapter " data-level="1.12" data-path="Tutorial_180709_StaticBlogging_JekyllandRuby.html">
<a href="Tutorial_180709_StaticBlogging_JekyllandRuby.html">
지킬과 루비로 정적 블로그 만들기
</a>
</li>
<li class="chapter " data-level="1.13" data-path="Tutorial_180710_Lecture_Cooperation.html">
<a href="Tutorial_180710_Lecture_Cooperation.html">
특강-협업
</a>
</li>
<li class="chapter " data-level="1.14" data-path="Tutorial_180710_Lecture_Speciality.html">
<a href="Tutorial_180710_Lecture_Speciality.html">
특강-전문성
</a>
</li>
<li class="chapter " data-level="1.15" data-path="Tutorial_180712_DataVisualization101.html">
<a href="Tutorial_180712_DataVisualization101.html">
데이터 시각화 이해
</a>
</li>
<li class="chapter " data-level="1.16" data-path="Tutorial_180712_AttraciveResume2.html">
<a href="Tutorial_180712_AttraciveResume2.html">
특강-자기소개서 워크숍(2)
</a>
</li>
<li class="chapter " data-level="1.17" data-path="Tutorial_180713_Pandas101.html">
<a href="Tutorial_180713_Pandas101.html">
자료의 요약 과제를 통한 판다스 실습
</a>
</li>
<li class="chapter " data-level="1.18" data-path="Tutorial_180713_ExperimentDesignLecture.html">
<a href="Tutorial_180713_ExperimentDesignLecture.html">
특강-실험계획에 관해 알아보기
</a>
</li>
<li class="chapter " data-level="1.19" data-path="Tutorial_180716_Crawling_Shuffle.html">
<a href="Tutorial_180716_Crawling_Shuffle.html">
저작권과 직업윤리를 인지하고 크롤링 셔플 실습
</a>
</li>
<li class="chapter " data-level="1.20" data-path="Tutorial_180716_Markup_Html5lib.html">
<a href="Tutorial_180716_Markup_Html5lib.html">
Markup Html5lib, 파이썬으로 크롤링하기
</a>
</li>
<li class="chapter " data-level="1.21" data-path="Tutorial_180717_10minPandas.html">
<a href="Tutorial_180717_10minPandas.html">
Pandas 10분 완성
</a>
</li>
<li class="chapter " data-level="1.22" data-path="Tutorial_180717_PandasPetition.html">
<a href="Tutorial_180717_PandasPetition.html">
국민청원 첫시작 판다스로 국민청원하기
</a>
</li>
<li class="chapter " data-level="1.23" data-path="Tutorial_180719_BeautifulSoup.html">
<a href="Tutorial_180719_BeautifulSoup.html">
Beautiful Soup을 사용하여 크롤링
</a>
</li>
<li class="chapter " data-level="1.24" data-path="Tutorial_180719_plotnine.md">
<span>
국민청원 데이터 시각화와 자연어 처리-plontnine 실습하기
</a>
</li>
<li class="chapter " data-level="1.25" data-path="Tutorial_180720_coupang.html">
<a href="Tutorial_180720_coupang.html">
특강 - 비전공자가 데이터 분석가로 취업하기
</a>
</li>
<li class="chapter " data-level="1.26" data-path="Tutorial_180720_ProbabilityDistribution.html">
<a href="Tutorial_180720_ProbabilityDistribution.html">
통계학-자료의 요약, 확률분포(ProbabilityDistribution)
</a>
</li>
<li class="chapter " data-level="1.27" data-path="Tutorial_180723_Machine_learning.html">
<a href="Tutorial_180723_Machine_learning.html">
기계학습의 기초(지도학습/비지도학습/머신러닝)
</a>
</li>
<li class="chapter " data-level="1.28" data-path="Tutorial_180723_word_vectorsization.html">
<a href="Tutorial_180723_word_vectorsization.html">
텍스트 데이터 시각화 Word_vectorsization
</a>
</li>
<li class="chapter " data-level="1.29" data-path="Tutorial_180726_naver.html">
<a href="Tutorial_180726_naver.html">
특강 - AI R&D Director
</a>
</li>
<li class="chapter " data-level="1.30" data-path="Tutorial_180726_library.md">
<span>
전국도서관표준데이터 분석
</a>
</li>
<li class="chapter " data-level="1.31" data-path="Tutorial_180730_Categorizing_v2.html">
<a href="Tutorial_180730_Categorizing_v2.html">
국민청원 카테고리 분류하기
</a>
</li>
<li class="chapter " data-level="1.32" data-path="Tutorial_180730_Kaggle_NLP_v2.html">
<a href="Tutorial_180730_Kaggle_NLP_v2.html">
Kaggle NLP로 예측율 높이기
</a>
</li>
<li class="chapter " data-level="1.33" data-path="Tutorial_180730_Statistics.html">
<a href="Tutorial_180730_Statistics.html">
Hypothesis test
</a>
</li>
<li class="chapter " data-level="1.34" data-path="Tutorial_180731_MTPlanning.html">
<a href="Tutorial_180731_MTPlanning.html">
데잇걸즈 MT 계획으로 애자일 프로세스 실습해보기
</a>
</li>
<li class="chapter " data-level="1.35" data-path="Tutorial_180802_ZigZag.html">
<a href="Tutorial_180802_ZigZag.html">
특강 - 쇼핑몰 데이터 분석 이야기
</a>
</li>
<li class="chapter " data-level="1.36" data-path="Tutorial_180803_GettingJobGithub.html">
<a href="Tutorial_180803_GettingJobGithub.html">
깃허브로 취업하기
</a>
</li>
<li class="chapter " data-level="1.37" data-path="Tutorial_180803_Statistics4.html">
<a href="Tutorial_180803_Statistics4.html">
회귀분석(Linear regression)
</a>
</li>
<li class="chapter " data-level="1.38" data-path="Tutorial_180806_Folium_practice.md">
<span>
공공데이터 상권정보 분석해 보기
</a>
</li>
<li class="chapter " data-level="1.39" data-path="Tutorial_180806_Geolocatin_API_practice.md">
<span>
서울창업허브(공덕역) 맛집지도
</a>
</li>
<li class="chapter " data-level="1.40" data-path="Tutorial_180806_XGBoost.md">
<span>
XGBoost 분산형 그래디언트 부스팅 알고리즘
</a>
</li>
<li class="chapter " data-level="1.41" data-path="Tutorial_180807_Git_review.html">
<a href="Tutorial_180807_Git_review.html">
깃과 깃헙 복습, 다른 사람의 레파지토리에 기여하기
</a>
</li>
<li class="chapter " data-level="1.42" data-path="Tutorial_180810_Apt_analysis_Statistics5.html">
<a href="Tutorial_180810_Apt_analysis_Statistics5.html">
아파트 분양가 분석 및 회귀분석2
</a>
</li>
<li class="chapter " data-level="1.43" data-path="Tutorial_180813_kaggle_Titanic.html">
<a href="Tutorial_180813_kaggle_Titanic.html">
스프레드시트로 캐글 타이타닉 참가하기
</a>
</li>
<li class="chapter " data-level="1.44" data-path="Tutorial_180814_Python_Class.html">
<a href="Tutorial_180814_Python_Class.html">
객체지향 프로그래밍
</a>
</li>
<li class="chapter " data-level="1.45" data-path="Tutorial_180814_Test_Driven_Development.html">
<a href="Tutorial_180814_Test_Driven_Development.html">
테스트 주도 개발
</a>
</li>
<li class="chapter " data-level="1.46" data-path="Tutorial_180817_Colors_in_Data_Visualization.md">
<span>
데이터 시각화와 색의 활용
</a>
</li>
<li class="chapter " data-level="1.47" data-path="Tutorial_180817_Statistics5.html">
<a href="Tutorial_180817_Statistics5.html">
통계-회귀분석3
</a>
</li>
<li class="divider"></li>
<li>
<a href="https://www.gitbook.com" target="blank" class="gitbook-link">
Published with GitBook
</a>
</li>
</ul>
</nav>
</div>
<div class="book-body">
<div class="body-inner">
<div class="book-header" role="navigation">
<!-- Title -->
<h1>
<i class="fa fa-circle-o-notch fa-spin"></i>
<a href="." >헌법개정안으로 깃베쉬, 소스트리, 브랜치 이해하기 </a>
</h1>
</div>
<div class="page-wrapper" tabindex="-1" role="main">
<div class="page-inner">
<div id="book-search-results">
<div class="search-noresults">
<section class="normal markdown-section">
<h2 id="2018년-6월-29일-오후-수업">2018년 6월 29일 오후 수업</h2>
<hr>
<p><strong>Push</strong>
내 PC의 로컬 저장소에서 변경된 이력을 원격 저장소에 공유하려면, 로컬 저장소의 변경 이력을 원격 저장소에 업로드해야 합니다.</p>
<p><strong>Clone</strong>
저장소를 복사하는 행위. 복제란 원격 저장소의 내용을 통째로 다운로드하는 것을 말합니다. 복제한 저장소를 다른 PC에서 로컬 저장소로 사용할 수 있게 됩니다.</p>
<p><strong>Pull</strong>
원격 저장소에서 로컬 저장소로 업데이트하려면 풀(Pull)을 실행합니다.pull 을 실행하면, 원격 저장소에서 최신 변경 이력을 다운로드하여 내 로컬 저장소에 그 내용을 적용합니다.</p>
<p>이번 실습은 로컬 폴더의 자료를 깃을 이용해 버전을 컨트롤하고 그 변경 사항을 깃헙에 push하는 과정을 헌법개정안 자료를 이용하여 실시하였습니다.</p>
<h3 id="gitbash">Gitbash</h3>
<p>깃을 설치했다면 터미널을 이용해 직접 디렉토리에 변경을 가하고 바로 원격저장소(remote = github in this case)에 올리는 작업을 하게 됩니다.
이것을 하는 곳이 바로 Git bash. Git bash는 google에 검색하여 맞는 OS, 34/64bit에 맞춰 설치합니다.</p>
<h3 id="실습01---1987년-헌법개정안으로-git-remote-add-commit-push-이해하기">실습01 - 1987년 헌법개정안으로 git, remote, add, commit, push 이해하기</h3>
<ol>
<li><p>다음의 링크에서 파일을 다운로드 받습니다. 파일명이 같기 때문에 1987년 파일을 먼저
받습니다.
<a href="https://drive.google.com/drive/u/0/folders/11REn11b5WaOTWVeHy-T3ddM48_Y_P7CB" target="_blank">https://drive.google.com/drive/u/0/folders/11REn11b5WaOTWVeHy-T3ddM48_Y_P7CB</a></p>
</li>
<li><p>git으로 관리할 폴더를 로컬(내 컴퓨터)에 하나 생성합니다. 폴더명은 constitution-kr 로 합니다.</p>
</li>
</ol>
<blockquote>
<p><strong>주의 사항</strong></p>
<p>중간 경로에 띄어쓰기가 된 이름이 없도록 유의하자.</p>
</blockquote>
<ol>
<li><p>git init 을 합니다.</p>
</li>
<li><p>git add “대한민국 헌법.txt” 로 git 으로 관리할 파일이라는 것을 지정해 줍니다. (여기에 있는
따옴표와 커밋하는 따옴표는 다르기 때문에 복붙하시지 말고 직접 타이핑 합니다.) </p>
</li>
<li><p>git commit -m “1987년 헌법" 으로 커밋 메시지를 작성하고 커밋합니다.
-m 이라는 옵션은 메시지를 뜻하며 옵션에 대한 도움말은 git commit -h 로 볼 수 있습니다.
git 명령어 -h로 대부분의 명령어에 대한 옵션 도움말을 볼 수 있습니다.</p>
</li>
<li><p>여기까지 로컬 컴퓨터에 있는 파일에 1987년 헌법 파일을 생성했습니다.</p>
</li>
<li><p>그럼 github으로 돌아가서 동일한 명칭으로 constitution-kr 이라는 저장소를 생성합니다.</p>
</li>
</ol>
<blockquote>
<p><strong>참고</strong></p>
<p>다음은 리드미 파일을 만들지 않고 아무런 옵션도 체크하지 않고 레파지토리를 만들었을 때 깃헙이 주는 안내다.
밑에 적힌 코드를 깃배시를 통해 constitution-kr 디렉토리를 찾아들어가 입력하면
"# constitution-kr"이 적혀진 README.md파일이 생성되어 깃헙에 푸시될 것이다.</p>
<p>echo "# constitution-kr" >> README.md</p>
<p>git init</p>
<p>git add README.md</p>
<p>git commit -m "first commit"</p>
<p>git remote add origin <a href="https://github.com/pje1740/constitution-kr.git" target="_blank">https://github.com/pje1740/constitution-kr.git</a></p>
<p>git push -u origin master</p>
</blockquote>
<ol>
<li>git remote add 로 리모트 저장소를 추가합니다.</li>
</ol>
<hr>
<p><strong>윈도우 SSH key</strong></p>
<p>지난 수업을 통해 소스트리를 이용한 ssh키 습득고 인증은 오류가 발생한다는 걸 알 수 있었다. </p>
<p>8번의 리모트 저장소는 git@로 시작하는 ssh key 주소를 의미한다. </p>
<p>다음은 윈도우를 위한 ssh key 등록 방법이다. </p>
<ol>
<li>ssh key를 가지고 있는지 확인을 먼저 해보자. 깃배시에서 다음과 같이 입력한다.<blockquote>
<p>cd ~/.ssh</p>
</blockquote>
</li>
</ol>
<p>숨김설정 된 파일도 보기 위해 다음을 입력한다.</p>
<blockquote>
<p>ls -al</p>
</blockquote>
<p>주소에 id_rsa.pub, id_rsa 파일이 있어야지 ssh key를 가지고 있는 것이다.
id_rsa.pub 에 있는 key 가 github 에 등록되어 있어야 ssh 프로토콜을 사용할 수 있다.</p>
<ol>
<li>현재 작업 중인 디렉토리로 cd를 이용해 돌아오자.</li>
</ol>
<p>git config --list를 깃배시에 입력하면 여러 줄이 뜨는데 이 때 밑에 remote.origin.url=<주소>가 있다.</p>
<p>일전에 https링크로 연동해두었다면 https링크가 적혀있을 것이다.</p>
<ol>
<li>깃헙으로 돌아가자. </li>
</ol>
<p>Settings > SSH로 가면 이전에 등록했던 ssh key가 있는데 삭제하고 다시 등록을 해야한다.</p>
<p>이곳에 기입할 ssh key는 깃배시에서 다음을 입력하여 얻을 수 있다.</p>
<blockquote>
<p>ssh-keygen -t rsa -b 4096 -C "계정주소"</p>
</blockquote>
<p>이 뒤에 따라오는 부분은 추가적인 메세지를 생성할지에 대한 옵션인데 없다면 엔터로 넘어가자.</p>
<p>이제 생성이 됐다면 </p>
<blockquote>
<p>:q</p>
</blockquote>
<p>를 입력하여 그 화면을 나가자. </p>
<p>직접 코드를 복사해도 좋지만 간단하게</p>
<blockquote>
<p>clip < ~/.ssh/id_rsa.pub</p>
</blockquote>
<p>를 입력하여 클립보드에 복사하자.</p>
<p>이후 깃헙에 코드를 붙여넣고 ssh key를 연동하자.</p>
<p>generating new ssh key는 다음의 주소에서 조금 더 자세하게 과정을 볼 수 있다.</p>
<p><a href="https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/" target="_blank">https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/</a></p>
<ol>
<li>다시 깃배시로 돌아오자.</li>
</ol>
<blockquote>
<p>git remote set-url origin <레파지토리의 ssh주소></p>
</blockquote>
<p>를 입력하여 깃헙과 로컬을 ssh로 연동하자.</p>
<p>이 과정에 정확히 됐는지 확인하려면</p>
<p>git remote -v를 입력해보면 된다.</p>
<p>이 때 </p>
<blockquote>
<p>origin <레파지토리의 ssh주소></p>
</blockquote>
<p>가 뜬다면 성공!</p>
<p>4번의 과정은 다음 링크를 참조하여도 좋다.</p>
<p><a href="https://help.github.com/articles/changing-a-remote-s-url/" target="_blank">https://help.github.com/articles/changing-a-remote-s-url/</a></p>
<p><strong>여기까지 SSH KEY 연동 방법이었습니다</strong></p>
<hr>
<ol>
<li>이제 로컬에 있는 파일을 github으로 관리할 수 있도록 push 해줄게요. git push -u origin master
위에서와 마찬가지로 git push -h 로 옵션에 대한 설명을 볼 수 있습니다.
보통 업스트림을 의미하는 -u와 강제로 푸시하는 -f 를 주로 사용할 예정입니다.</li>
</ol>
<blockquote>
<p><strong>origin? master?</strong></p>
<p>master란 내 로컬 마스터 브랜치를 의미한다.</p>
<p>origin이란 원격저장소(깃헙)의미한다. </p>
<p>즉 git push -u origin master는</p>
<p>내가 마스터 브랜치에서 수정한 사항을 오리진으로 푸시해서 업데이트 해달라는 요청이다.</p>
<p>문법적인 부분은 다음 링크를 참고하면 좋다.
<a href="https://stackoverflow.com/questions/18137175/in-git-what-is-the-difference-between-origin-master-vs-origin-master" target="_blank">https://stackoverflow.com/questions/18137175/in-git-what-is-the-difference-between-origin-master-vs-origin-master</a> (참고)</p>
</blockquote>
<ol>
<li>github 으로 가서 해당 파일이 업데이트 되었는지 확인해 봅니다. </li>
</ol>
<p>실습01 정리) git bash에 타이핑할 1~10번까지의 전체 소스 코드입니다.</p>
<blockquote>
<p>git init</p>
<p>git add "대한민국 헌법.txt"</p>
<p>git commit -m "1987년 헌법"</p>
<p>git remote add origin <a href="https://github.com/oranjieunk/constitution-kr.git" target="_blank">https://github.com/oranjieunk/constitution-kr.git</a></p>
<p>git push -u origin master</p>
</blockquote>
<p><strong>오류 해결 방법</strong>
오류 메시지를 그대로 google에 검색하고, 해결 방법을 탐색해 봅시다.
예) Updates were rejected because the remote contains work that you do not have locally
가 뜨는 경우가 있는데 마지막에 git push -u origin master대신에 git push -f origin master를 사용하면 됩니다.</p>
<h3 id="실습02---2018년-헌법개정안으로-브랜치-이해하기">실습02 - 2018년 헌법개정안으로 브랜치 이해하기</h3>
<ol>
<li><p>2018년 헌법개정안 파일을 다운로드 받습니다.
<a href="https://drive.google.com/drive/u/0/folders/11REn11b5WaOTWVeHy-T3ddM48_Y_P7CB" target="_blank">https://drive.google.com/drive/u/0/folders/11REn11b5WaOTWVeHy-T3ddM48_Y_P7CB</a></p>
</li>
<li><p>git checkout -b “2018” 로 만듭니다. (가끔 터미널에서 한글 인코딩 문제로 오류가 발생하기
때문에 영문과 숫자로만 사용하는 것을 권장합니다.) 해당 명령어는 브랜치를 만들고 변경해
주는 역할을 합니다.
<a href="https://git-scm.com/book/ko/v1/Git-%EB%B8%8C%EB%9E%9C%EC%B9%98-%EB%B8
%8C%EB%9E%9C%EC%B9%98%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B
0%80%3F" target="_blank">Git - 브랜치란
무엇인가?</a></p>
</li>
<li><p>git branch 명령어를 실행하면 2개의 브랜치 목록이 나오며 활성화 되어 있는 브랜치 앞에
별표가 표시됩니다.</p>
</li>
<li><p>git checkout master 를 해보면 다시 마스터 브랜치로 이동하고, git checkout 2018로 2018
브랜치로 이동합니다.</p>
</li>
<li><p>브랜치를 이동한 상태에서 다운로드 받은 2018년 파일을 이 폴더로 옮겨줍니다.
즉, 덮어씁니다.</p>
</li>
<li><p>git add “대한민국 헌법.txt” 로 변경상태를 Stage 상태로 보냅니다.
스테이지로 보낸다 함은 index로 집어넣는 개념과 동일. add문을 쓰고 있으니.</p>
</li>
<li><p>git commit -m “2018년 개정안" 으로 커밋 메시지를 작성하고 커밋합니다.</p>
</li>
<li><p>git push -u origin 2018 로 깃헙에 푸시합니다. (1987년 과정과 브랜치가 다릅니다.)</p>
</li>
<li><p>github 으로 가서 2018 브랜치를 master 브랜치로 pull request를 생성합니다.
이 pull request메시지는 깃헙에서 새로고침 해보면 상단에 바로 표시가 된다.</p>
</li>
</ol>
<p>실습02 정리) git bash에 타이핑할 1~9번까지의 전체 소스 코드입니다.</p>
<blockquote>
<p>git checkout -b 2018</p>
<p>git add "대한민국 헌법.txt"</p>
<p>git commit -m "2018년 개정안"</p>
<p>git push -u origin 2018</p>
<p>=> github 페이지에서 Pull request 생성하고, Merge하기</p>
</blockquote>
<p>이전 실습에서는 포크해온 저장소에 풀리퀘스트를 보냈지만, 이번에는 같은 저장소에서 다른
브랜치를 통해 풀리퀘스트를 생성했습니다.</p>
</section>
</div>
<div class="search-results">
<div class="has-results">
<h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
<ul class="search-results-list"></ul>
</div>
<div class="no-results">
<h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
</div>
</div>
</div>
</div>
</div>
</div>
<a href="Tutorial_180628_Git_and_Github.html" class="navigation navigation-prev " aria-label="Previous page: Git과 Github, 기본 개념과 설명">
<i class="fa fa-angle-left"></i>
</a>
<a href="Tutorial_180629_Github_practice_Statistics1.html" class="navigation navigation-next " aria-label="Next page: 확률통계 기초와 깃허브 실습 ">
<i class="fa fa-angle-right"></i>
</a>
</div>
<script>
var gitbook = gitbook || [];
gitbook.push(function() {
gitbook.page.hasChanged({"page":{"title":"헌법개정안으로 깃베쉬, 소스트리, 브랜치 이해하기 ","level":"1.3","depth":1,"next":{"title":" 확률통계 기초와 깃허브 실습 ","level":"1.4","depth":1,"path":"Tutorial_180629_Github_practice_Statistics1.md","ref":"Tutorial_180629_Github_practice_Statistics1.md","articles":[]},"previous":{"title":"Git과 Github, 기본 개념과 설명","level":"1.2","depth":1,"path":"Tutorial_180628_Git_and_Github.md","ref":"Tutorial_180628_Git_and_Github.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{"BASE_URL":"https://dataitgirls2.github.io"},"plugins":["ga","-sharing"],"pluginsConfig":{"ga":{"configuration":"auto","token":"UA-43356518-7"},"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"Tutorial_180629_Git_with_constitution.md","mtime":"2018-07-28T22:58:53.186Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2018-09-09T04:41:47.437Z"},"basePath":".","book":{"language":""}});
});
</script>
</div>
<script src="gitbook/gitbook.js"></script>
<script src="gitbook/theme.js"></script>
<script src="gitbook/gitbook-plugin-ga/plugin.js"></script>
<script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
<script src="gitbook/gitbook-plugin-search/search.js"></script>