Git安装与配置

简介:

(一)Git概述

  Git是一款免费、开源的分布式版本控制系统,用于敏捷高效地处理任何或小或大的项目。

  Git是一个开源的分布式版本控制系统,可以有效、高速的处理从很小到非常大的项目版本管理。[2]  Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。

Git 与常用的版本控制工具 CVS, Subversion 等不同,它采用了分布式版本库的方式,不必服务器端软件支持。

           ----------百度百科


Git 与 SVN 区别点:

  • 1、GIT是分布式的,SVN是集中式的:这是GIT和其它非分布式的版本控制系统,例如SVN,CVS等,最核心的区别。

  • 2、GIT把内容按元数据方式存储,而SVN是按文件:所有的资源控制系统都是把文件的元信息隐藏在一个类似.svn,.cvs等的文件夹里。

  • 3、GIT分支和SVN的分支不同:分支在SVN中一点不特别,就是版本库中的另外的一个目录。

  • 4、GIT没有一个全局的版本号,而SVN有:目前为止这是跟SVN相比GIT缺少的最大的一个特征。

  • 5、GIT的内容完整性要优于SVN:GIT的内容存储使用的是SHA-1哈希算法。这能确保代码内容的完整性,确保在遇到磁盘故障和网络问题时降低对版本库的破坏。


(二)Git安装

Git 的工作需要调用 curl,zlib,openssl,expat,libiconv 等库的代码,所以需要先安装这些依赖工具。在有 yum 的系统上(比如 Fedora)或者有 apt-get 的系统上(比如 Debian 体系),可以用下面的命令安装:

    (1)Linux平台上安装编译安装git服务端

1
2
3
1. #######安装git所对应的编译包
[root@Server5 git-2.14.2] # yum install gcc-c++ perl-ExtUtils-MakeMaker
[root@Server5 git-2.14.2] # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
2. #######官网上下载源码安装包(https://www.kernel.org/pub/software/scm/git/ ----源码安装包需要make && make install进行编译安装 
https: //github .com /git/git/releases   ----编译好的包直接使用)
 
[root@Server5  install ] # wget https://www.kernel.org/pub/software/scm/git/git-2.
14.2. tar .gz
--2017-10-10 09:22:53--  https: //www .kernel.org /pub/software/scm/git/git-2 .14.2. tar .gz
Resolving www.kernel.org... 147.75.110.187, 2604:1380:3000:3500::3
Connecting to www.kernel.org|147.75.110.187|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7001045 (6.7M) [application /x-gzip ]
Saving to: “git-2.14.2. tar .gz”
 
100%[======================================>] 7,001,045   36.6K /s    in  3m 40s  
 
2017-10-10 09:26:35 (31.0 KB /s ) - “git-2.14.2. tar .gz” saved [7001045 /7001045 ]
 
[root@Server5  install ] # tar xf git-2.14.2.tar.gz 
[root@Server5  install ] # cd git-2.14.2
 
[root@Server5 git-2.14.2] # make configure    ###编译配置
     GEN configure
    
[root@Server5 git-2.14.2] # ./configure --prefix=/usr/git    ###配置目录 
configure: Setting lib to  'lib'  (the default)
configure: Will try -pthread  then  -lpthread to  enable  POSIX Threads.
configure: CHECKS  for  site configuration
checking  for  gcc... gcc
checking  for  C compiler default output  file  name... a.out
checking whether the C compiler works...  yes
checking whether we are cross compiling... no
checking  for  suffix of executables... 
checking  for  suffix of object files... o
checking whether we are using the GNU C compiler...  yes
checking whether gcc accepts -g...  yes
checking  for  gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking  for  grep  that handles long lines and -e...  /bin/grep
checking  for  egrep ...  /bin/grep  -E
checking  for  ANSI C header files...  yes
checking  for  sys /types .h...  yes
checking  for  sys /stat .h...  yes
checking  for  stdlib.h...  yes
checking  for  string.h...  yes
checking  for  memory.h...  yes
checking  for  strings.h...  yes
checking  for  inttypes.h...  yes
checking  for  stdint.h...  yes
checking  for  unistd.h...  yes
checking  for  working alloca.h...  yes
checking  for  alloca...  yes
configure: CHECKS  for  programs
checking whether we are using the GNU C compiler... (cached)  yes
checking whether gcc accepts -g... (cached)  yes
checking  for  gcc option to accept ISO C89... (cached) none needed
checking  for  inline... inline
checking  if  linker supports -R... no
checking  if  linker supports -Wl,-rpath,...  yes
checking  for  gar... no
checking  for  ar... ar
checking  for  gtar... gtar
checking  for  gnudiff... no
checking  for  gdiff... no
checking  for  diff ...  diff
checking  for  asciidoc... no
Using  'grep -a'  for  sane_grep
configure: CHECKS  for  libraries
checking  for  SHA1_Init  in  -lcrypto...  yes
checking  for  curl_global_init  in  -lcurl...  yes
checking  for  curl-config... curl-config
checking  if  Curl supports SSL...  yes
checking  for  XML_ParserCreate  in  -lexpat...  yes
checking  for  iconv  in  -lc...  yes
checking  for  deflateBound  in  -lz...  yes
checking  for  socket  in  -lc...  yes
checking  for  inet_ntop...  yes
checking  for  inet_pton...  yes
checking  for  hstrerror...  yes
checking  for  basename  in  -lc...  yes
checking  for  gettext  in  -lc...  yes
checking libintl.h usability...  yes
checking libintl.h presence...  yes
checking  for  libintl.h...  yes
configure: CHECKS  for  header files
checking sys /select .h usability...  yes
checking sys /select .h presence...  yes
checking  for  sys /select .h...  yes
checking sys /poll .h usability...  yes
checking sys /poll .h presence...  yes
checking  for  sys /poll .h...  yes
checking  for  inttypes.h... (cached)  yes
checking  for  old iconv()... no
configure: CHECKS  for  typedefs, structures, and compiler characteristics
checking  for  socklen_t...  yes
checking  for  struct itimerval...  yes
checking  for  struct stat.st_mtimespec.tv_nsec... no
checking  for  struct stat.st_mtim.tv_nsec...  yes
checking  for  struct dirent.d_type...  yes
checking  for  struct  passwd .pw_gecos...  yes
checking  for  struct sockaddr_storage...  yes
checking  for  struct addrinfo...  yes
checking  for  getaddrinfo...  yes
checking  for  library containing getaddrinfo... none required
checking whether the platform regex supports REG_STARTEND...  yes
checking whether system succeeds to  read  fopen'ed directory...  yes
checking whether snprintf() and /or  vsnprintf()  return  bogus value... no
checking whether the platform uses typical  file  type  bits...  yes
configure: CHECKS  for  library functions
checking libgen.h usability...  yes
checking libgen.h presence...  yes
checking  for  libgen.h...  yes
checking paths.h usability...  yes
checking paths.h presence...  yes
checking  for  paths.h...  yes
checking libcharset.h usability... no
checking libcharset.h presence... no
checking  for  libcharset.h... no
checking  for  strings.h... (cached)  yes
checking  for  locale_charset  in  -liconv... no
checking  for  locale_charset  in  -lcharset... no
checking  for  clock_gettime... no
checking  for  CLOCK_MONOTONIC...  yes
checking  for  setitimer...  yes
checking  for  library containing setitimer... none required
checking  for  strcasestr...  yes
checking  for  library containing strcasestr... none required
checking  for  memmem...  yes
checking  for  library containing memmem... none required
checking  for  strlcpy... no
checking  for  uintmax_t...  yes
checking  for  strtoumax...  yes
checking  for  library containing strtoumax... none required
checking  for  setenv...  yes
checking  for  library containing setenv... none required
checking  for  unsetenv...  yes
checking  for  library containing unsetenv... none required
checking  for  mkdtemp...  yes
checking  for  library containing mkdtemp... none required
checking  for  initgroups...  yes
checking  for  library containing initgroups... none required
checking  for  getdelim...  yes
checking  for  library containing getdelim... none required
checking  for  BSD sysctl... no
checking  for  POSIX Threads with  '' ... no
checking  for  POSIX Threads with  '-mt' ... no
checking  for  POSIX Threads with  '-pthread' ...  yes
configure: creating . /config .status
config.status: creating config.mak.autogen
config.status: executing config.mak.autogen commands
 
[root@Server5 git-2.14.2] # make profix=/usr/git    ####编译配置路径
     * new build flags
     CC credential-store.o
     * new link flags
     CC common-main.o
     CC abspath.o
     CC advice.o
     CC  alias .o
     CC alloc.o
     CC apply.o
     CC archive.o
     CC archive- tar .o
     CC archive-zip.o
     CC argv-array.o
     * new prefix flags
     CC attr.o
     CC base85.o
     CC bisect.o
     CC blame.o
     CC blob.o
     CC branch.o
     CC bulk-checkin.o
     CC bundle.o
     CC cache-tree.o
     CC color.o
     CC column.o
     CC combine- diff .o
     CC commit.o
     CC compat /obstack .o
     CC compat /terminal .o
     CC config.o
     CC connect.o
     CC connected.o
     CC convert.o
     CC copy.o
     CC credential.o
     CC csum- file .o
     CC ctype.o
     CC  date .o
     CC decorate.o
     CC diffcore- break .o
     CC diffcore-delta.o
     CC diffcore-order.o
     CC diffcore-pickaxe.o
     CC diffcore-rename.o
     CC  diff -delta.o
     CC  diff -lib.o
     CC  diff -no-index.o
     CC  diff .o
     CC  dir .o
     CC  dir -iterator.o
     CC editor.o
     CC entry.o
     CC environment.o
     CC ewah /bitmap .o
     CC ewah /ewah_bitmap .o
     CC ewah /ewah_io .o
     CC ewah /ewah_rlw .o
     CC exec_cmd.o
     CC fetch-pack.o
     CC  fsck .o
     CC gettext.o
     CC gpg-interface.o
     CC graph.o
     CC  grep .o
     CC hashmap.o
     GEN common-cmds.h
     CC help.o
     CC hex.o
     CC ident.o
     CC kwset.o
     CC levenshtein.o
     CC line-log.o
     CC line-range.o
     CC list-objects.o
     CC ll-merge.o
     CC lockfile.o
     CC log-tree.o
     CC mailinfo.o
     CC mailmap.o
     CC match-trees.o
     CC merge.o
     CC merge-blobs.o
     CC merge-recursive.o
     CC mergesort.o
     CC mru.o
     CC name- hash .o
     CC notes.o
     CC notes-cache.o
     CC notes-merge.o
     CC notes-utils.o
     CC object.o
     CC oidset.o
     CC pack-bitmap.o
     CC pack-bitmap-write.o
     CC pack-check.o
     CC pack-objects.o
     CC pack-revindex.o
     CC pack-write.o
     CC pager.o
     CC parse-options.o
     CC parse-options-cb.o
     CC patch-delta.o
     CC patch-ids.o
     CC path.o
     CC pathspec.o
     CC pkt-line.o
     CC preload-index.o
     CC pretty.o
     CC prio-queue.o
     CC progress.o
     CC prompt.o
     CC quote.o
     CC reachable.o
     CC  read -cache.o
     CC reflog-walk.o
     CC refs.o
     CC refs /files-backend .o
     CC refs /iterator .o
     CC refs /ref-cache .o
     CC ref-filter.o
     CC remote.o
     CC replace_object.o
     CC repository.o
     CC rerere.o
     CC resolve-undo.o
     CC revision.o
     CC run- command .o
     CC send-pack.o
     CC sequencer.o
     CC server-info.o本文转自 lqbyz 51CTO博客,原文链接:http://blog.51cto.com/liqingbiao/1970979
相关文章
|
2天前
|
JavaScript 数据可视化 网络安全
Hexo博客重新部署与Git配置
重装电脑后,作者更新了Hexo与NexT主题。首先,安装了Node.js和git,配置了git的用户信息,并生成SSH密钥。因旧版本导致问题,作者决定重新部署。按照步骤安装Hexo,选择了NexT主题,并安装了多个插件。遇到错误时,通过查阅资料解决了问题。此外,作者自定义了页脚、侧边栏内容,包括访客统计、词云、建站时间等,并更换了背景图,添加了Daovoice聊天界面。参考了多篇教程解决过程中遇到的各类问题。
17 6
|
3月前
|
安全 Shell 网络安全
【Git】TortoiseGit(小乌龟)配置SSH和使用
【Git】TortoiseGit(小乌龟)配置SSH和使用
169 0
|
3天前
|
开发工具 git
Git项目如何配置,如何上传至GitHub。其详细步骤
Git项目如何配置,如何上传至GitHub。其详细步骤
7 0
|
11天前
|
Unix Shell 开发工具
windows下如何安装git以及IDEA如何配置git
该文指导安装Git 2.15.0版本。首先从Git官网下载最新安装包,双击安装,依次选择Next,同意默认配置,确保勾选添加到环境变量。在配置选项中,选择在cmd中使用Git(第2项),行结束转换选Windows(第1项),终端模拟器选MinTTY(第1项)。安装完成后,通过右键菜单或直接打开Git Bash验证安装成功。最后,配置全局用户名和邮箱,并在IDEA中设置Git路径以完成集成。
|
15天前
|
Ubuntu Linux 网络安全
|
18天前
|
安全 开发工具 git
Windows11搭建Python环境(2)- Anaconda虚拟环境中安装Git
Windows11搭建Python环境(2)- Anaconda虚拟环境中安装Git
23 0
|
1月前
|
开发工具 git
git添加对勾图标 TortoiseGit安转配置
git添加对勾图标 TortoiseGit安转配置
20 0
|
1月前
|
网络安全 开发工具 数据安全/隐私保护
git篇1:git下载安装、使用
git篇1:git下载安装、使用
|
1月前
|
开发工具 数据安全/隐私保护 git
git安装
git安装
|
2月前
|
Linux 开发工具 git
IntelliJ IDEA配置git工作效率翻倍
IntelliJ IDEA 是一个强大的集成开发环境,用于编程语言如 Java、Kotlin、Scala 和其他多种语言。Git 是一个开源的分布式版本控制系统,用于追踪项目过程中的代码变更。
88 0
IntelliJ IDEA配置git工作效率翻倍