热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

【git】ubuntu12.04美化gitweb

在之前的文章http:blog.csdn.netcommsharearticledetails18368695中,我们安装了一个gitweb,感觉界面很

在之前的文章  http://blog.csdn.net/commshare/article/details/18368695   中,我们安装了一个gitweb,感觉界面很难看啊,firefox比chrome好看一点。

想美化一下:

zhangbin@Ubuntu32:~/alex/gitProject$ pwd
/home/zhangbin/alex/gitProject
zhangbin@Ubuntu32:~/alex/gitProject$ git clone git://github.com/kogakure/gitweb-theme
fatal: could not create work tree dir 'gitweb-theme'.: Permission denied
zhangbin@Ubuntu32:~/alex/gitProject$ sudo git clone git://github.com/kogakure/gitweb-theme
[sudo] password for zhangbin: 
Cloning into 'gitweb-theme'...
remote: Reusing existing pack: 228, done.
Receiving objects: 100% (228/228), 678.89 KiB | 50 KiB/s, done.
Resolving deltas: 100% (69/69), done.
remote: Total 228 (delta 0), reused 0 (delta 0)
zhangbin@Ubuntu32:~/alex/gitProject$ 



看了下 git-theme:http://kogakure.github.io/gitweb-theme/  要求的git版本是1.7.12+的。


Dependencies

git web interface version 1.7.12 (though it may work in older versions, too …)


而我的ubuntu默认是:

root@Ubuntu32:/home/zhangbin/alex/gitProject/gitweb-theme/gitINSTALL/git-1.8.5# git version
git version 1.7.9.5
root@Ubuntu32:/home/zhangbin/alex/gitProject/gitweb-theme/gitINSTALL/git-1.8.5#  

没有css文件。这里我搞错了,其实人家说的是gitweb的版本吧????!!!不是git的!!!!!

后来发现, gitweb是git里头的!!!那就没有错咯!!

=============

git-core当前最新的是1.8.5的git,可以在这里下载https://code.google.com/p/git-core/downloads/detail?name=git-1.8.5.3.tar.gz&can=2&q=


本想参考http://learnhow.no-ip.org/2013/06/12/%E5%9C%A8ubuntu-12-04%E5%AE%89%E8%A3%9D%E6%9C%80%E6%96%B0%E7%89%88%E7%9A%84git/

自己编译一个新版的:

root@Ubuntu32:/home/zhangbin/alex/gitProject/gitweb-theme/gitINSTALL/git-1.8.5# make prefix=/usr all

 make install prefix=/usr all 


也有人说http://stackoverflow.com/questions/14409639/unable-to-update-git-on-ubuntu  要这么装:

wget git-core.googlecode.com/files/git-1.8.1.1.tar.gz
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1
make prefix=/usr/local all
sudo make prefix=/usr/local install


==============

但是发现更有效的方法是:


root@Ubuntu32:/home/git# whereis git
git: /usr/bin/git /usr/bin/X11/git /usr/share/man/man1/git.1.gz



root@Ubuntu32:/home/git# sudo add-apt-repository ppa:git-core/ppa
You are about to add the following PPA to your system:
 The most current stable version of Git for Ubuntu.


For release candidates, go to https://launchpad.net/~git-core/+archive/candidate .
 More info: https://launchpad.net/~git-core/+archive/ppa
Press [ENTER] to continue or ctrl-c to cancel adding it


gpg: keyring `/tmp/tmpzy9mnU/secring.gpg' created
gpg: keyring `/tmp/tmpzy9mnU/pubring.gpg' created
gpg: requesting key E1DF1F24 from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpzy9mnU/trustdb.gpg: trustdb created
gpg: key E1DF1F24: public key "Launchpad PPA for Ubuntu Git Maintainers" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK



root@Ubuntu32:/home/git# sudo apt-get update
Hit http://mirrors.sohu.com precise Release.gpg
Get:1 http://mirrors.sohu.com precise-updates Release.gpg [198 B]              
Hit http://mirrors.sohu.com precise-backports Release.gpg                      
Get:2 http://mirrors.sohu.com precise-security Release.gpg [198 B]             
Hit http://mirrors.sohu.com precise Release                      



                               
root@Ubuntu32:/home/git# apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  git-arch git-cvs git-daemon-run git-email git-gui git-man git-svn gitk
  gitweb libyaml-perl
Suggested packages:
  git-bzr git-mediawiki libyaml-shell-perl
Recommended packages:
  libyaml-libyaml-perl libyaml-syck-perl
The following NEW packages will be installed:
  libyaml-perl
The following packages will be upgraded:
  git git-arch git-cvs git-daemon-run git-email git-gui git-man git-svn gitk
  gitweb
10 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 15.7 MB of archives.
After this operation, 6,887 kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Get:1 http://us.archive.ubuntu.com/ubuntu/ precise/main libyaml-perl all 0.77-1 [70.4 kB]
Get:2 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git i386 1:1.8.5.2-1~ppa0~precise1 [9,402 kB]
Get:3 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-svn all 1:1.8.5.2-1~ppa0~precise1 [637 kB]
Get:4 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-gui all 1:1.8.5.2-1~ppa0~precise1 [822 kB]
Get:5 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-email all 1:1.8.5.2-1~ppa0~precise1 [562 kB]
Get:6 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-daemon-run all 1:1.8.5.2-1~ppa0~precise1 [543 kB]
Get:7 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-cvs all 1:1.8.5.2-1~ppa0~precise1 [654 kB]
Get:8 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-arch all 1:1.8.5.2-1~ppa0~precise1 [556 kB]
Get:9 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main gitk all 1:1.8.5.2-1~ppa0~precise1 [673 kB]
Get:10 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main git-man all 1:1.8.5.2-1~ppa0~precise1 [1,225 kB]
Get:11 http://ppa.launchpad.net/git-core/ppa/ubuntu/ precise/main gitweb all 1:1.8.5.2-1~ppa0~precise1 [546 kB]
Fetched 15.7 MB in 4min 52s (53.7 kB/s)                                        
(Reading database ... 566732 files and directories currently installed.)
Preparing to replace git 1:1.7.9.5-1 (using .../git_1%3a1.8.5.2-1~ppa0~precise1_i386.deb) ...
Unpacking replacement git ...
Preparing to replace git-svn 1:1.7.9.5-1 (using .../git-svn_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-svn ...
Preparing to replace git-gui 1:1.7.9.5-1 (using .../git-gui_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-gui ...
Preparing to replace git-email 1:1.7.9.5-1 (using .../git-email_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-email ...
Preparing to replace git-daemon-run 1:1.7.9.5-1 (using .../git-daemon-run_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-daemon-run ...
Preparing to replace git-cvs 1:1.7.9.5-1 (using .../git-cvs_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-cvs ...
Preparing to replace git-arch 1:1.7.9.5-1 (using .../git-arch_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-arch ...
Preparing to replace gitk 1:1.7.9.5-1 (using .../gitk_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement gitk ...
Preparing to replace git-man 1:1.7.9.5-1 (using .../git-man_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement git-man ...
Preparing to replace gitweb 1:1.7.9.5-1 (using .../gitweb_1%3a1.8.5.2-1~ppa0~precise1_all.deb) ...
Unpacking replacement gitweb ...
Selecting previously unselected package libyaml-perl.
Unpacking libyaml-perl (from .../libyaml-perl_0.77-1_all.deb) ...
Processing triggers for man-db ...
Setting up git-man (1:1.8.5.2-1~ppa0~precise1) ...
Setting up git (1:1.8.5.2-1~ppa0~precise1) ...
Installing new version of config file /etc/bash_completion.d/git ...
Setting up libyaml-perl (0.77-1) ...
Setting up git-svn (1:1.8.5.2-1~ppa0~precise1) ...
Setting up git-gui (1:1.8.5.2-1~ppa0~precise1) ...
Setting up git-email (1:1.8.5.2-1~ppa0~precise1) ...
Setting up git-daemon-run (1:1.8.5.2-1~ppa0~precise1) ...
Installing new version of config file /etc/sv/git-daemon/run ...
Service git-daemon already added.
ok: run: git-daemon: (pid 14103) 1s
Setting up git-cvs (1:1.8.5.2-1~ppa0~precise1) ...
Setting up git-arch (1:1.8.5.2-1~ppa0~precise1) ...
Setting up gitk (1:1.8.5.2-1~ppa0~precise1) ...
Setting up gitweb (1:1.8.5.2-1~ppa0~precise1) ...


Configuration file `/etc/gitweb.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** gitweb.conf (Y/I/N/O/D/Z) [default=N] ? y
Installing new version of config file /etc/gitweb.conf ...
 * Reloading web server config apache2                                          apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                         [ OK ]
root@Ubuntu32:/home/git# 


替换为新版的gitweb.conf,然后重启apache2:


root@Ubuntu32:/home/git# sudo /etc/init.d/apache2 restart
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                                         [ OK ]
root@Ubuntu32:/home/git# 



=======================按照github的gitweb主题=============

好像直接copy也行:

zhangbin@Ubuntu32:~/alex/gitProject/gitweb-theme$ cp gitweb.css /usr/share/gitweb/static/
cp: cannot create regular file `/usr/share/gitweb/static/gitweb.css': Permission denied
zhangbin@Ubuntu32:~/alex/gitProject/gitweb-theme$ sudo cp gitweb.css /usr/share/gitweb/static/


或者是用这个命令:
zhangbin@Ubuntu32:~/alex/gitProject/gitweb-theme$ sudo ./setup -vi --install
./setup: [NOTICE] - Target not set, using default path: '/usr/share/gitweb'
./setup: 
./setup: Is this ok? [y] | [n] : y
./setup: 
./setup: Backing up original files, continue? [y] | [n] : y
./setup: 
./setup: Backing up...
./setup: 
`/usr/share/gitweb/static/gitweb.css' -> `/usr/share/gitweb/static/gitweb.css.bak'
`/usr/share/gitweb/static/git-favicon.png' -> `/usr/share/gitweb/static/git-favicon.png.bak'
`/usr/share/gitweb/static/git-logo.png' -> `/usr/share/gitweb/static/git-logo.png.bak'
./setup: 
./setup: ...done
./setup: 
./setup: Linking theme files, continue? [y] | [n] : y
./setup: 
./setup: Linking...
./setup: 
`/usr/share/gitweb/static/gitweb.css' -> `/home/zhangbin/alex/gitProject/gitweb-theme/gitweb.css'
`/usr/share/gitweb/static/git-favicon.png' -> `/home/zhangbin/alex/gitProject/gitweb-theme/git-favicon.png'
`/usr/share/gitweb/static/git-logo.png' -> `/home/zhangbin/alex/gitProject/gitweb-theme/git-logo.png'

./setup: 
./setup: ...done
./setup: 
./setup: [NOTICE] - Installation complete!
zhangbin@Ubuntu32:~/alex/gitProject/gitweb-theme$ 


=================即使这样,我的gitweb也不显示css样式啥的,真是无语了===========

改了好久,终于参看这位大牛的文章:http://blog.chinaunix.net/uid-9672747-id-3486257.html


出现的问题在于,apache的gitweb配置中gitweb文件的路径,写错了,gitweb的别名应该指向gitweb文件存放的路径:


$favicon = "/gitweb/static/git-favicon.png";# git-diff-tree(1) options to use for generated patches
#@diff_opts = ("-M");
@diff_opts = ();
###add by me
$prevent_xss = 1;
$highlight_bin = "/usr/bin/highlight";
$feature{'highlight'}{'default'} = [1];
$feature{'timed'}{'default'} = [1];
#$feature{'highlight'}{'default'} = [1];





=====

apache的gitweb:

sudo gedit  /etc/apache2/conf.d/gitweb


Alias /gitweb /usr/share/gitweb
Options FollowSymLinks +ExecCGIAddHandler cgi-script .cgi





============ 发现source insight写的中文注释在gitweb里头是乱码,而且有很多\r,难道是因为windows的格式的原因???====

参考 http://blog.mylover.cn/2014/01/%E5%85%B3%E4%BA%8Egitweb%E4%B8%AD%E4%B8%AD%E6%96%87%E6%96%87%E4%BB%B6%E5%90%8D%E4%B9%B1%E7%A0%81%E5%8F%8A%E4%BB%A3%E7%A0%81%E9%AB%98%E4%BA%AE%E7%9A%84%E9%97%AE%E9%A2%98/


关于gitweb中中文文件名乱码及代码高亮的问题

  1. 关于在gitweb中中文文件名乱码的问题

今天突然发现,在gitweb中看到(1)log内中文是正常的,(2)中文目录名是正常的,(3)文件只要是utf-8编码的,中文也是正常的,但如果是中文的文件名,则显示的链接名是正常的,但链接编码却不正常,但前面的中文目录编码是正常的,使得所有指向链接都不对了,主要问题是中文文件名没有转为utf-8编码,解决办法:

把gitweb.cgi中所有 file_name=>”$basedir$t->{‘name’}” 替换为 file_name=>”$basedir” . to_utf8($t->{‘name’}) 即可。

  1. gitweb中代码高亮的问题


关于gitweb中代码的高亮,前提是安装好 highlight,一般已经有了,如果没有,使用 apt-get install highlight 安装即可,但在 gitweb 中默认没有打开这个支持,编辑 /etc/gitweb.conf 文件,在最后面加入一行:$feature{‘highlight’}{‘default’} = [1];

但有些代码还是不支持高亮,比如cs文件,这时可以察看 /usr/share/highlight/langDefs目录下的支持类型,在gitweb.conf中定义highlight_ext的地方,自行添加需要的后缀名就可以了。

======================http://blog.163.com/sunshine_linting/blog/static/44893323201339102723893/


(1)source insight 阅读VC++源码,注释为乱码解决方案

1、options->preferences->Syntax Formatting->Styles;
2、在Style Name 选择 Comment,再对其Font Name 选择Pick,然后再选择“新宋体”。

(2)source insight 阅读Linux源码,注释为乱码解决方案

1、用记事本打开源文件,中文可以显示,另存为,在保存选项中,编码一栏发现是:UTF-8。选在ANSI一项,保存。再用Source Insight 打开,终于可以显示了。





推荐阅读
  • 如何使用Java获取服务器硬件信息和磁盘负载率
    本文介绍了使用Java编程语言获取服务器硬件信息和磁盘负载率的方法。首先在远程服务器上搭建一个支持服务端语言的HTTP服务,并获取服务器的磁盘信息,并将结果输出。然后在本地使用JS编写一个AJAX脚本,远程请求服务端的程序,得到结果并展示给用户。其中还介绍了如何提取硬盘序列号的方法。 ... [详细]
  • 本文介绍了如何使用PHP向系统日历中添加事件的方法,通过使用PHP技术可以实现自动添加事件的功能,从而实现全局通知系统和迅速记录工具的自动化。同时还提到了系统exchange自带的日历具有同步感的特点,以及使用web技术实现自动添加事件的优势。 ... [详细]
  • 欢乐的票圈重构之旅——RecyclerView的头尾布局增加
    项目重构的Git地址:https:github.comrazerdpFriendCircletreemain-dev项目同步更新的文集:http:www.jianshu.comno ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 本文介绍了使用kotlin实现动画效果的方法,包括上下移动、放大缩小、旋转等功能。通过代码示例演示了如何使用ObjectAnimator和AnimatorSet来实现动画效果,并提供了实现抖动效果的代码。同时还介绍了如何使用translationY和translationX来实现上下和左右移动的效果。最后还提供了一个anim_small.xml文件的代码示例,可以用来实现放大缩小的效果。 ... [详细]
  • 云原生边缘计算之KubeEdge简介及功能特点
    本文介绍了云原生边缘计算中的KubeEdge系统,该系统是一个开源系统,用于将容器化应用程序编排功能扩展到Edge的主机。它基于Kubernetes构建,并为网络应用程序提供基础架构支持。同时,KubeEdge具有离线模式、基于Kubernetes的节点、群集、应用程序和设备管理、资源优化等特点。此外,KubeEdge还支持跨平台工作,在私有、公共和混合云中都可以运行。同时,KubeEdge还提供数据管理和数据分析管道引擎的支持。最后,本文还介绍了KubeEdge系统生成证书的方法。 ... [详细]
  • 本文介绍了数据库的存储结构及其重要性,强调了关系数据库范例中将逻辑存储与物理存储分开的必要性。通过逻辑结构和物理结构的分离,可以实现对物理存储的重新组织和数据库的迁移,而应用程序不会察觉到任何更改。文章还展示了Oracle数据库的逻辑结构和物理结构,并介绍了表空间的概念和作用。 ... [详细]
  • 本文分享了一个关于在C#中使用异步代码的问题,作者在控制台中运行时代码正常工作,但在Windows窗体中却无法正常工作。作者尝试搜索局域网上的主机,但在窗体中计数器没有减少。文章提供了相关的代码和解决思路。 ... [详细]
  • 知识图谱——机器大脑中的知识库
    本文介绍了知识图谱在机器大脑中的应用,以及搜索引擎在知识图谱方面的发展。以谷歌知识图谱为例,说明了知识图谱的智能化特点。通过搜索引擎用户可以获取更加智能化的答案,如搜索关键词"Marie Curie",会得到居里夫人的详细信息以及与之相关的历史人物。知识图谱的出现引起了搜索引擎行业的变革,不仅美国的微软必应,中国的百度、搜狗等搜索引擎公司也纷纷推出了自己的知识图谱。 ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • Ubuntu安装常用软件详细步骤
    目录1.GoogleChrome浏览器2.搜狗拼音输入法3.Pycharm4.Clion5.其他软件1.GoogleChrome浏览器通过直接下载安装GoogleChro ... [详细]
  • 31.项目部署
    目录1一些概念1.1项目部署1.2WSGI1.3uWSGI1.4Nginx2安装环境与迁移项目2.1项目内容2.2项目配置2.2.1DEBUG2.2.2STAT ... [详细]
  • mac php错误日志配置方法及错误级别修改
    本文介绍了在mac环境下配置php错误日志的方法,包括修改php.ini文件和httpd.conf文件的操作步骤。同时还介绍了如何修改错误级别,以及相应的错误级别参考链接。 ... [详细]
  • 本文整理了Java面试中常见的问题及相关概念的解析,包括HashMap中为什么重写equals还要重写hashcode、map的分类和常见情况、final关键字的用法、Synchronized和lock的区别、volatile的介绍、Syncronized锁的作用、构造函数和构造函数重载的概念、方法覆盖和方法重载的区别、反射获取和设置对象私有字段的值的方法、通过反射创建对象的方式以及内部类的详解。 ... [详细]
  • HashMap的相关问题及其底层数据结构和操作流程
    本文介绍了关于HashMap的相关问题,包括其底层数据结构、JDK1.7和JDK1.8的差异、红黑树的使用、扩容和树化的条件、退化为链表的情况、索引的计算方法、hashcode和hash()方法的作用、数组容量的选择、Put方法的流程以及并发问题下的操作。文章还提到了扩容死链和数据错乱的问题,并探讨了key的设计要求。对于对Java面试中的HashMap问题感兴趣的读者,本文将为您提供一些有用的技术和经验。 ... [详细]
author-avatar
我心永恒2602922374_902
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有