整个流程如下:(参考文章:linux安装git方法)
[[email protected] 桌面]$ wget https://github.com/git/git/archive/v2.8.3.zip --2016-05-23 14:43:32-- https://github.com/git/git/archive/v2.8.3.zip 正在解析主机 github.com... 192.30.252.130 正在连接 github.com|192.30.252.130|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 302 Found 位置:https://codeload.github.com/git/git/zip/v2.8.3 [跟随至新的 URL] --2016-05-23 14:43:34-- https://codeload.github.com/git/git/zip/v2.8.3 正在解析主机 codeload.github.com... 192.30.252.162 正在连接 codeload.github.com|192.30.252.162|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:未指定 [application/zip] 正在保存至: “v2.8.3” [ <=> ] 7,048,716 1.44M/s in 5.2s 2016-05-23 14:43:40 (1.30 MB/s) - “v2.8.3” 已保存 [7048716] [[email protected] 桌面]# unzip v2.8.3 [[email protected] 桌面]# cp -r git-2.8.3 /opt/git2.8.3 [[email protected] 桌面]# cd /opt/git2.8.3 [[email protected] git2.8.3]# ls abspath.c git-sh-i18n.sh run-command.c aclocal.m4 git-sh-setup.sh run-command.h advice.c git.spec.in send-pack.c advice.h git-stash.sh send-pack.h alias.c git-submodule.sh sequencer.c alloc.c git-svn.perl sequencer.h archive.c GIT-VERSION-GEN server-info.c archive.h gitweb setup.c archive-tar.c git-web--browse.sh sha1-array.c archive-zip.c gpg-interface.c sha1-array.h argv-array.c gpg-interface.h sha1_file.c argv-array.h graph.c sha1-lookup.c attr.c graph.h sha1-lookup.h attr.h grep.c sha1_name.c base85.c grep.h shallow.c bisect.c hashmap.c shell.c bisect.h hashmap.h sh-i18n--envsubst.c blob.c help.c shortlog.h blob.h help.h show-index.c block-sha1 hex.c sideband.c branch.c http-backend.c sideband.h branch.h http.c sigchain.c builtin http-fetch.c sigchain.h builtin.h http.h split-index.c bulk-checkin.c http-push.c split-index.h bulk-checkin.h http-walker.c strbuf.c bundle.c ident.c strbuf.h bundle.h imap-send.c streaming.c cache.h INSTALL streaming.h cache-tree.c khash.h string-list.c cache-tree.h kwset.c string-list.h check_bindir kwset.h submodule.c check-builtins.sh levenshtein.c submodule-config.c check-racy.c levenshtein.h submodule-config.h color.c LGPL-2.1 submodule.h color.h line-log.c symlinks.c column.c line-log.h t column.h line-range.c tag.c combine-diff.c line-range.h tag.h command-list.txt list-objects.c tar.h commit.c list-objects.h tempfile.c commit.h ll-merge.c tempfile.h commit-slab.h ll-merge.h templates compat lockfile.c test-chmtime.c config.c lockfile.h test-config.c config.mak.in log-tree.c test-ctype.c config.mak.uname log-tree.h test-date.c configure.ac mailinfo.c test-delta.c connect.c mailinfo.h test-dump-cache-tree.c connected.c mailmap.c test-dump-split-index.c connected.h mailmap.h test-dump-untracked-cache.c connect.h Makefile test-fake-ssh.c contrib match-trees.c test-genrandom.c convert.c merge-blobs.c test-hashmap.c convert.h merge-blobs.h test-index-version.c copy.c merge.c test-line-buffer.c COPYING merge-recursive.c test-match-trees.c credential.c merge-recursive.h test-mergesort.c credential-cache.c mergesort.c test-mktemp.c credential-cache--daemon.c mergesort.h test-parse-options.c credential.h mergetools test-path-utils.c credential-store.c name-hash.c test-prio-queue.c csum-file.c notes.c test-read-cache.c csum-file.h notes-cache.c test-regex.c ctype.c notes-cache.h test-revision-walking.c daemon.c notes.h test-run-command.c date.c notes-merge.c test-scrap-cache-tree.c decorate.c notes-merge.h test-sha1-array.c decorate.h notes-utils.c test-sha1.c delta.h notes-utils.h test-sha1.sh diff.c object.c test-sigchain.c diffcore-break.c object.h test-string-list.c diffcore-delta.c pack-bitmap.c test-submodule-config.c diffcore.h pack-bitmap.h test-subprocess.c diffcore-order.c pack-bitmap-write.c test-svn-fe.c diffcore-pickaxe.c pack-check.c test-urlmatch-normalization.c diffcore-rename.c pack.h test-wildmatch.c diff-delta.c pack-objects.c thread-utils.c diff.h pack-objects.h thread-utils.h diff-lib.c pack-revindex.c trace.c diff-no-index.c pack-revindex.h trace.h dir.c pack-write.c trailer.c dir.h pager.c trailer.h Documentation parse-options.c transport.c editor.c parse-options-cb.c transport.h entry.c parse-options.h transport-helper.c environment.c patch-delta.c tree.c ewah patch-ids.c tree-diff.c exec_cmd.c patch-ids.h tree.h exec_cmd.h path.c tree-walk.c fast-import.c pathspec.c tree-walk.h fetch-pack.c pathspec.h unicode_width.h fetch-pack.h perl unimplemented.sh fmt-merge-msg.h pkt-line.c unix-socket.c fsck.c pkt-line.h unix-socket.h fsck.h po unpack-trees.c generate-cmdlist.sh ppc unpack-trees.h gettext.c preload-index.c update_unicode.sh gettext.h pretty.c upload-pack.c git-add--interactive.perl prio-queue.c url.c git-archimport.perl prio-queue.h url.h git-bisect.sh progress.c urlmatch.c git.c progress.h urlmatch.h git-compat-util.h prompt.c usage.c git-cvsexportcommit.perl prompt.h userdiff.c git-cvsimport.perl quote.c userdiff.h git-cvsserver.perl quote.h utf8.c git-difftool--helper.sh reachable.c utf8.h git-difftool.perl reachable.h varint.c git-filter-branch.sh read-cache.c varint.h git-gui README.md vcs-svn git-instaweb.sh ref-filter.c version.c gitk-git ref-filter.h versioncmp.c git-merge-octopus.sh reflog-walk.c version.h git-merge-one-file.sh reflog-walk.h walker.c git-merge-resolve.sh refs walker.h git-mergetool--lib.sh refs.c wildmatch.c git-mergetool.sh refs.h wildmatch.h git-p4.py RelNotes worktree.c git-parse-remote.sh remote.c worktree.h git-quiltimport.sh remote-curl.c wrap-for-bin.sh git.rc remote.h wrapper.c git-rebase--am.sh remote-testsvn.c write_or_die.c git-rebase--interactive.sh replace_object.c ws.c git-rebase--merge.sh rerere.c wt-status.c git-rebase.sh rerere.h wt-status.h git-relink.perl resolve-undo.c xdiff git-remote-testgit.sh resolve-undo.h xdiff-interface.c git-request-pull.sh revision.c xdiff-interface.h git-send-email.perl revision.h zlib.c 编译安装: 将其安装在“/usr/local/git”目录下 先编译 [[email protected] git2.8.3]# make prefix=/usr/local/git all GIT_VERSION = 2.8.3 * new build flags CC credential-store.o /bin/sh: cc: command not found make: *** [credential-store.o] 错误 127 解决方法:安装git依赖的包 [[email protected] git2.8.3]# yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker 再次编译:make prefix=/usr/local/git all就ok了 然后安装 [[email protected] git2.8.3]# make prefix=/usr/local/git install SUBDIR perl /usr/bin/perl Makefile.PL PREFIX=‘/usr/local/git‘ INSTALL_BASE=‘‘ --localedir=‘/usr/local/git/share/locale‘ Writing perl.mak for Git GEN git-add--interactive GEN git-difftool GEN git-archimport GEN git-cvsexportcommit GEN git-cvsimport GEN git-cvsserver GEN git-relink GEN git-send-email GEN git-svn SUBDIR git-gui SUBDIR gitk-git SUBDIR perl /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <private-Error.pm >blib/lib/Error.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Editor.pm >blib/lib/Git/SVN/Editor.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Migration.pm >blib/lib/Git/SVN/Migration.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Log.pm >blib/lib/Git/SVN/Log.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN.pm >blib/lib/Git/SVN.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Memoize/YAML.pm >blib/lib/Git/SVN/Memoize/YAML.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/I18N.pm >blib/lib/Git/I18N.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Ra.pm >blib/lib/Git/SVN/Ra.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Prompt.pm >blib/lib/Git/SVN/Prompt.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/GlobSpec.pm >blib/lib/Git/SVN/GlobSpec.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Fetcher.pm >blib/lib/Git/SVN/Fetcher.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/IndexInfo.pm >blib/lib/Git/IndexInfo.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git/SVN/Utils.pm >blib/lib/Git/SVN/Utils.pm /usr/bin/perl -pe "s<\Q++LOCALEDIR++\E></usr/local/git/share/locale>" <Git.pm >blib/lib/Git.pm SUBDIR templates install -d -m 755 ‘/usr/local/git/bin‘ install -d -m 755 ‘/usr/local/git/libexec/git-core‘ install git-credential-store git-daemon git-fast-import git-http-backend git-imap-send git-sh-i18n--envsubst git-shell git-show-index git-upload-pack git-remote-testsvn git-http-fetch git-http-push git-credential-cache git-credential-cache--daemon git-remote-http git-remote-https git-remote-ftp git-remote-ftps git-bisect git-difftool--helper git-filter-branch git-merge-octopus git-merge-one-file git-merge-resolve git-mergetool git-quiltimport git-rebase git-request-pull git-stash git-submodule git-web--browse git-add--interactive git-difftool git-archimport git-cvsexportcommit git-cvsimport git-cvsserver git-relink git-send-email git-svn git-p4 git-instaweb ‘/usr/local/git/libexec/git-core‘ install -m 644 git-mergetool--lib git-parse-remote git-rebase--am git-rebase--interactive git-rebase--merge git-sh-setup git-sh-i18n ‘/usr/local/git/libexec/git-core‘ install git git-upload-pack git-receive-pack git-upload-archive git-shell git-cvsserver ‘/usr/local/git/bin‘ make -C templates DESTDIR=‘‘ install make[1]: Entering directory `/opt/git2.8.3/templates‘ install -d -m 755 ‘/usr/local/git/share/git-core/templates‘ (cd blt && tar cf - .) | (cd ‘/usr/local/git/share/git-core/templates‘ && umask 022 && tar xof -) make[1]: Leaving directory `/opt/git2.8.3/templates‘ install -d -m 755 ‘/usr/local/git/libexec/git-core/mergetools‘ install -m 644 mergetools/* ‘/usr/local/git/libexec/git-core/mergetools‘ install -d -m 755 ‘/usr/local/git/share/locale‘ (cd po/build/locale && tar cf - .) | (cd ‘/usr/local/git/share/locale‘ && umask 022 && tar xof -) make -C perl prefix=‘/usr/local/git‘ DESTDIR=‘‘ install make[1]: Entering directory `/opt/git2.8.3/perl‘ make[2]: Entering directory `/opt/git2.8.3/perl‘ Installing /usr/local/git/share/perl5/Git.pm Installing /usr/local/git/share/perl5/Error.pm Installing /usr/local/git/share/perl5/Git/SVN.pm Installing /usr/local/git/share/perl5/Git/I18N.pm Installing /usr/local/git/share/perl5/Git/IndexInfo.pm Installing /usr/local/git/share/perl5/Git/SVN/Log.pm Installing /usr/local/git/share/perl5/Git/SVN/Editor.pm Installing /usr/local/git/share/perl5/Git/SVN/Ra.pm Installing /usr/local/git/share/perl5/Git/SVN/Migration.pm Installing /usr/local/git/share/perl5/Git/SVN/Fetcher.pm Installing /usr/local/git/share/perl5/Git/SVN/Prompt.pm Installing /usr/local/git/share/perl5/Git/SVN/GlobSpec.pm Installing /usr/local/git/share/perl5/Git/SVN/Utils.pm Installing /usr/local/git/share/perl5/Git/SVN/Memoize/YAML.pm Installing /usr/local/git/share/man/man3/Git.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Memoize::YAML.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Ra.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Fetcher.3pm Installing /usr/local/git/share/man/man3/private-Error.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Prompt.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Utils.3pm Installing /usr/local/git/share/man/man3/Git::SVN::Editor.3pm Installing /usr/local/git/share/man/man3/Git::I18N.3pm Appending installation info to /usr/local/git/lib64/perl5/perllocal.pod make[2]: Leaving directory `/opt/git2.8.3/perl‘ make[1]: Leaving directory `/opt/git2.8.3/perl‘ make -C gitweb install make[1]: Entering directory `/opt/git2.8.3/gitweb‘ make[2]: Entering directory `/opt/git2.8.3‘ make[2]: “GIT-VERSION-FILE”是最新的。 make[2]: Leaving directory `/opt/git2.8.3‘ GEN gitweb.cgi GEN static/gitweb.js install -d -m 755 ‘/usr/local/git/share/gitweb‘ install -m 755 gitweb.cgi ‘/usr/local/git/share/gitweb‘ install -d -m 755 ‘/usr/local/git/share/gitweb/static‘ install -m 644 static/gitweb.js static/gitweb.css static/git-logo.png static/git-favicon.png ‘/usr/local/git/share/gitweb/static‘ make[1]: Leaving directory `/opt/git2.8.3/gitweb‘ make -C gitk-git install make[1]: Entering directory `/opt/git2.8.3/gitk-git‘ install -m 755 gitk-wish ‘/usr/local/git/bin‘/gitk install -d -m 755 ‘/usr/local/git/share/gitk/lib/msgs‘ install -m 644 po/bg.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/ca.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/de.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/es.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/fr.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/hu.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/it.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/ja.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/pt_br.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/ru.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/sv.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && install -m 644 po/vi.msg ‘/usr/local/git/share/gitk/lib/msgs‘ && true make[1]: Leaving directory `/opt/git2.8.3/gitk-git‘ make -C git-gui gitexecdir=‘/usr/local/git/libexec/git-core‘ install make[1]: Entering directory `/opt/git2.8.3/git-gui‘ DEST /usr/local/git/libexec/git-core INSTALL 755 git-gui INSTALL 755 git-gui--askpass LINK git-citool -> git-gui DEST /usr/local/git/share/git-gui/lib INSTALL 644 tclIndex INSTALL 644 about.tcl INSTALL 644 blame.tcl INSTALL 644 branch_checkout.tcl INSTALL 644 branch_create.tcl INSTALL 644 branch_delete.tcl INSTALL 644 branch_rename.tcl INSTALL 644 branch.tcl INSTALL 644 browser.tcl INSTALL 644 checkout_op.tcl INSTALL 644 choose_font.tcl INSTALL 644 choose_repository.tcl INSTALL 644 choose_rev.tcl INSTALL 644 class.tcl INSTALL 644 commit.tcl INSTALL 644 console.tcl INSTALL 644 database.tcl INSTALL 644 date.tcl INSTALL 644 diff.tcl INSTALL 644 encoding.tcl INSTALL 644 error.tcl INSTALL 644 index.tcl INSTALL 644 line.tcl INSTALL 644 logo.tcl INSTALL 644 merge.tcl INSTALL 644 mergetool.tcl INSTALL 644 option.tcl INSTALL 644 remote_add.tcl INSTALL 644 remote_branch_delete.tcl INSTALL 644 remote.tcl INSTALL 644 search.tcl INSTALL 644 shortcut.tcl INSTALL 644 spellcheck.tcl INSTALL 644 sshkey.tcl INSTALL 644 status_bar.tcl INSTALL 644 themed.tcl INSTALL 644 tools_dlg.tcl INSTALL 644 tools.tcl INSTALL 644 transport.tcl INSTALL 644 win32.tcl INSTALL 644 git-gui.ico INSTALL 644 win32_shortcut.js DEST /usr/local/git/share/git-gui/lib/msgs INSTALL 644 bg.msg INSTALL 644 de.msg INSTALL 644 el.msg INSTALL 644 fr.msg INSTALL 644 hu.msg INSTALL 644 it.msg INSTALL 644 ja.msg INSTALL 644 nb.msg INSTALL 644 pt_br.msg INSTALL 644 ru.msg INSTALL 644 sv.msg INSTALL 644 vi.msg INSTALL 644 zh_cn.msg make[1]: Leaving directory `/opt/git2.8.3/git-gui‘ bindir=$(cd ‘/usr/local/git/bin‘ && pwd) && execdir=$(cd ‘/usr/local/git/libexec/git-core‘ && pwd) && { test "$bindir/" = "$execdir/" || for p in git git-shell git-upload-pack git-cvsserver; do rm -f "$execdir/$p" && test -z "" && ln "$bindir/$p" "$execdir/$p" 2>/dev/null || cp "$bindir/$p" "$execdir/$p" || exit; done; } && for p in git-receive-pack git-upload-archive; do rm -f "$bindir/$p" && test -z "" && ln "$bindir/git" "$bindir/$p" 2>/dev/null || ln -s "git" "$bindir/$p" 2>/dev/null || cp "$bindir/git" "$bindir/$p" || exit; done && for p in git-add git-am git-annotate git-apply git-archive git-bisect--helper git-blame git-branch git-bundle git-cat-file git-check-attr git-check-ignore git-check-mailmap git-check-ref-format git-checkout-index git-checkout git-clean git-clone git-column git-commit-tree git-commit git-config git-count-objects git-credential git-describe git-diff-files git-diff-index git-diff-tree git-diff git-fast-export git-fetch-pack git-fetch git-fmt-merge-msg git-for-each-ref git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object git-help git-index-pack git-init-db git-interpret-trailers git-log git-ls-files git-ls-remote git-ls-tree git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file git-merge-index git-merge-ours git-merge-recursive git-merge-tree git-mktag git-mktree git-mv git-name-rev git-notes git-pack-objects git-pack-redundant git-pack-refs git-patch-id git-prune-packed git-prune git-pull git-push git-read-tree git-receive-pack git-reflog git-remote git-remote-ext git-remote-fd git-repack git-replace git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm git-send-pack git-shortlog git-show-branch git-show-ref git-stripspace git-submodule--helper git-symbolic-ref git-tag git-unpack-file git-unpack-objects git-update-index git-update-ref git-update-server-info git-upload-archive git-var git-verify-commit git-verify-pack git-verify-tag git-worktree git-write-tree git-cherry git-cherry-pick git-format-patch git-fsck-objects git-init git-merge-subtree git-show git-stage git-status git-whatchanged; do rm -f "$execdir/$p" && test -z "" && ln "$execdir/git" "$execdir/$p" 2>/dev/null || ln -s "git" "$execdir/$p" 2>/dev/null || cp "$execdir/git" "$execdir/$p" || exit; done && remote_curl_aliases="git-remote-https git-remote-ftp git-remote-ftps" && for p in $remote_curl_aliases; do rm -f "$execdir/$p" && test -z "" && ln "$execdir/git-remote-http" "$execdir/$p" 2>/dev/null || ln -s "git-remote-http" "$execdir/$p" 2>/dev/null || cp "$execdir/git-remote-http" "$execdir/$p" || exit; done && ./check_bindir "z$bindir" "z$execdir" "$bindir/git-add" 查看git所在的路径: [[email protected] git2.8.3]# whereis git git: /usr/local/git [[email protected] etc]# cd /usr/local/git/bin 查看新安装的git版本号: [[email protected] bin]# ./git --version git version 2.8.3
其他可参考文章:centos编译安装git最新版本
时间: 2024-10-13 22:42:29