
Hi, Habr!
All programmers are divided into those who use the version control system, and those who are not yet using it. One of the most popular today is git. And although its structure is aimed at decentralized data storage, we all use github, assembla, bitbucket, or githost. The main disadvantage of these hosting sites is that they are foreign projects that at any time can cover your account or merge data to the left. And then GitBlit appears on the scene! Git server in Java, completely controlled by you, with a lot of buns and a web interface. Today we will launch it on a free hosting from Redhat.
')
Preamble, you can not read
When I learned about free hosting from Redhat at the beginning of summer, I immediately wanted to post something there, but there was a problem: I don’t do web development, I don’t have any projects and I don’t need any hosting. The man is the most cold-blooded person for free, and it was just a freebie, so my brain gave the idea: “Let's make our own git server!”. After googling, I found only one git server in Java, which was not only actively developed, but could, according to the author, work on openshift hosting. After the tests and the introduction of active use, a burning desire to tell about it to everyone in the district appeared. Half a year was written, but suddenly it was summer, and, as a result, all projects were frozen until autumn. Autumn has come, I finally finished the articles and submit it to your judgment.
A bit of theory, the main features.
The description of the possibilities is honestly torn off the site and translated into our great and mighty one.
Four types of access control configurations for each storage:
- Anonymous browsing, cloning and downloading to the repository
- Authorized download to the repository
- Authorized cloning and loading into the repository
- Authorized viewing, cloning and downloading to the repository
- Repository freeze (read only)
Main buns:
- Based on JGit SmartHTTP servlet
- Ability to merge with other Gitblit servers
- RSS / JSON RPC interface
- Cross-Platform Java Gitblit Manager
- Web interface adapted for phones, tablets and ordinary computers.
- Using groovy scripts in hooks before uploading to the server and after; You can set the action of the hooks for a separate repository or globally, for all
- Email notifications after uploading to server (via sendmail.groovy script)
- Indexing Lucene repository branches
- Administrators can create, edit, rename or delete repositories, users and groups via the web interface or RPC interface (manager)
- Repository owners can edit via the web interface.
- Administrators and owners of the repository can establish the main branch via the web interface or the RPC interface.
- LDAP authentication and optional LDAP user list
- Gravatar integration
- Supports Git Tag Mapping
- Supports displaying GH pages (Jekyll is not supported)
- Markdown file display supported
- Branch statistics (used by Google Charts)
- RSS feeds branches
- Supported use of the browser time zone when displaying the date and time
- Supports hiding e-mail addresses of the author and committer
- Register independent search on commit messages, authors and committers
- Source code syntax highlighting
- Additional utilities
- Documentation page containing all Markdown repository files
- Ticgit page (based on the latest MIT bf57b032 release 2009-01-27)
Languages:
- English
- Japanese
- Spanish
- Polish
There is a desire to translate into the Great and Mighty?
Welcome to
www.getlocalization.com/gitblitScreenshots:
gitblit.com/screenshots.htmlDemo server:
demo-gitblit.rhcloud.comNow go to practice
Installation
Register for openshiftCreate a JBoss Application Server
https://openshift.redhat.com/app/console/application_types/jbossas-7Next, following the instructions, add your ssh-key and execute git clone.
In my case, for example:
git clone ssh://461e96291a2d2fb96b4423a0a329c7@habr-dark008.rhcloud.com/~/git/habr.git/
Go to the application folder:
cd habr/
Clear the folder from the standard stub:
rm -R *
Download gitblit:
wget https://gitblit.googlecode.com/files/express-1.1.0.zip
Unzip the habr folder and delete the archive:
unzip express-1.1.0.zip && rm express-1.1.0.zip
We configure a config to the address:
habr / deployments / ROOT.war / WEB-INF / web.xmlSet to
true :
web.enableRpcManagement
web.enableRpcAdministrationAnd
web.forwardSlashCharacter is on
!As sensible paranoids, we redirect all traffic via https.
Create a
jboss-web.xml file in the same folder (WEB-INF) with the following content:
<jboss-web> <security-domain>jboss-web-policy</security-domain> <valve> <class-name>org.jboss.web.rewrite.RewriteValve</class-name> </valve> </jboss-web>
Create a file
rewrite.properties in the same folder (WEB-INF) with the following redirection rules:
RewriteCond %{HTTP:X-Forwarded-Proto} http RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
This completes the server side configuration.
Fill the data on the server by performing the sacred:
git add . git commit -m 'Init git server' git push
Now the last step is setting.
Download the manager for remote administration gitblit:
gitblit.googlecode.com/files/manager-1.1.0.zipConnect to our server habr-dark008.rhcloud.com, login and password are standard: admin, admin.
You only need to change the administrator password, the rest of the settings at your discretion.
The server can also be configured via the web interface, but the author advises to use the manager: it has more settings, fewer glitches.
More fine-tuning:
gitblit.com/setup.htmlLinks
Sources:
github.com/gitblit or
code.google.com/p/gitblit/source/listBug Tracker:
code.google.com/p/gitblit/issues/listDiscussion:
groups.google.com/group/gitblitGoogle+:
plus.google.com/114464678392593421684Thanks to Andrey Suvorov for reviewing the text.