In the previous article http://blog.csdn.net/commshare/article/details/18368695, we installed a gitweb, the feeling of the interface is very difficult to see Ah, Firefox than Chrome look a little better.
To beautify yourself:
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 | KIB/S, done.
Resolving deltas:100% (69/69), done.
Remote:total 228 (Delta 0), reused 0 (Delta 0)
zhangbin@ubuntu32:~/alex/gitproject$
Look at the git-theme:http://kogakure.github.io/gitweb-theme/requirements of the Git version is 1.7.12+.
“
Dependencies
Git Web interface version 1.7.12 (though it may work in older versions, too ...)
”
And my Ubuntu defaults are:
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#
There are no CSS files. Here I was mistaken, in fact, people say is gitweb version of it .... Not git ...
It turned out that Gitweb was in git. There's nothing wrong with that.
=============
Git-core is currently the latest 1.8.5 git that can be downloaded here https://code.google.com/p/git-core/downloads/detail?name=git-1.8.5.3.tar.gz &can=2&q=
Would like to refer to the 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/
Compile a new version of yourself:
root@ubuntu32:/home/zhangbin/alex/gitproject/gitweb-theme/gitinstall/git-1.8.5# make prefix=/usr all
Make install PREFIX=/USR all
Some people say that http://stackoverflow.com/questions/14409639/unable-to-update-git-on-ubuntu to do so:
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
==============
But finding a more effective way is to:
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 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 would 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 would be installed:
Libyaml-perl
The following packages would be upgraded:
git git-arch git-cvs git-daemon-run git-email Git-gui git-man git-svn gitk
Gitweb
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 would be used.
Do your 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 or by a script) since installation.
==> Package Distributor has shipped an updated version.
What would you have the 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 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 s Erver ' s fully qualified domain name, using 127.0.0.1 for ServerName
[OK]
root@ubuntu32:/home/git#
Replace with the new gitweb.conf and restart Apache2:
root@ubuntu32:/home/git# sudo/etc/init.d/apache2 Restart
* Restarting Web server apache2 apache2:could not reliably determine the s Erver ' 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#
======================= according to GitHub Gitweb theme =============
It seems that direct copy is OK:
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/
Or use this command:
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$
================= Even so, my gitweb does not show CSS style what, really silent ===========
Changed for a long time, finally see this Daniel's article: http://blog.chinaunix.net/uid-9672747-id-3486257.html
The problem is that the path to the Gitweb file in Apache's gitweb configuration is wrong, and the Gitweb alias should point to the path where the Gitweb file is stored:
Then Apache will read the Gitweb configuration from here.
And before/var/www set up gitweb then point to/usr/share/gitweb, said can not ... Isn't it.
I also according to Daniel's configuration, the CSS style of what, also changed:
Joined the/gitweb/, really effective, estimated that this/gitweb is appearing in the Apache configuration of the/gitweb Mody .... It's so weird ...
Anyway, now there's a github style.
====================================================
Gitweb.conf
# Path to git projects (<project>.git)
$projectroot = "/home/zhangbin/alex/gitproject";
# directory to use for temp files
$git _temp = "/tmp";
# target of the ' home link on ' All pages
# $home _link = $my _uri | | "/";
# HTML text to include at home page
# $home _text = ' indextext.html ';
# file with Project list; By default, simply scan the Projectroot dir.
# $projects _list = $projectroot;
# stylesheet to use
@stylesheets = ("/gitweb/static/gitweb.css");
# JavaScript code for Gitweb
$javascript = "/gitweb/static/gitweb.js";
# logo to use
$logo = "/gitweb/static/git-logo.png";
# the ' favicon '
$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's Gitweb:
sudo gedit/etc/apache2/conf.d/gitweb
Alias/gitweb/usr/share/gitweb
<Directory/home/git/repositories>
Options followsymlinks +execcgi
AddHandler cgi-script. CGI
</Directory>
============ found source insight written in Chinese comments in Gitweb is garbled, and there are a lot of R, is because of the format of Windows reasons ... ====
Reference 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/
on the problem of Chinese filename garbled and code highlighting in Gitweb January 19, 2014 develop git, gitweb, Syntaxhighlighter, Ubuntu about the problem of garbled Chinese file names in Gitweb
Today, it suddenly occurred to me that it is normal to see the Chinese in log (1) in Gitweb. (2) Chinese directory name is normal, (3) As long as the file is Utf-8 encoded, Chinese is normal, but if the file name in Chinese, the display of the link name is normal, but the link code is not normal, However, the previous Chinese directory encoding is normal, so that all points to the link is wrong, the main problem is that the Chinese file name has not been converted to UTF-8 encoding, the solution:
Replace All file_name=> "$basedir $t->{' name '}" in gitweb.cgi with File_name=> "$basedir". To_utf8 ($t->{' name '}). The problem of code highlighting in Gitweb
About Gitweb code in the highlight, the premise is to install good highlight, generally already have, if not, use Apt-get install highlight installation can, but in the Gitweb default does not open this support, edit/etc/ gitweb.conf file, add one line on the last side: $feature {' highlight '} {' default '} = [1];
But some code still does not support highlighting, such as CS file, then you can see the/usr/share/highlight/langdefs directory support type, in the gitweb.conf definition Highlight_ext Place, add the necessary suffix name on your own.
======================http://blog.163.com/sunshine_linting/blog/static/44893323201339102723893/
(1) Source Insight reading VC + + source code, comments for garbled solution
1, Options->preferences->syntax formatting->styles;
2, select Comment in style name, then select pick for its font name, then select "New Song Body".
(2) Source Insight reading Linux Source code, comments for garbled solution
1, with Notepad to open the source file, Chinese can be displayed, save as, in the Save options, code A column found is: UTF-8. Selected in ANSI one, save. again with source Insight open, finally can show.