.gitignore
@@ -6,3 +6,4 @@ /*.zip /gitblit.properties /users.properties /site build.xml
@@ -3,27 +3,27 @@ <!-- Project Properties --> <property name="project.jar" value="gitblit.jar" /> <property name="project.mainclass" value="com.gitblit.Launcher" /> <property name="project.mainclass" value="com.gitblit.Launcher" /> <property name="project.build.dir" value="${basedir}/build" /> <target name="main"> <!-- extract version number from source code --> <loadfile property="gb.version" srcfile="${basedir}/src/com/gitblit/Constants.java"> <filterchain> <linecontains> <contains value="public final static String VERSION = "/> </linecontains> <striplinebreaks/> <tokenfilter> <replacestring from="public final static String VERSION = "" to=""/> <replacestring from="";" to=""/> <contains value="public final static String VERSION = " /> </linecontains> <striplinebreaks /> <tokenfilter> <replacestring from="public final static String VERSION = "" to="" /> <replacestring from="";" to="" /> <trim /> </tokenfilter> </filterchain> </loadfile> <echo>Building Git:Blit ${gb.version}</echo> <!-- copy required distribution files to project folder --> <copy todir="${basedir}" overwrite="false"> <fileset dir="${basedir}/distrib"> @@ -31,7 +31,7 @@ <include name="users.properties" /> </fileset> </copy> <!-- Compile the build tool and execute it. This downloads missing compile-time dependencies from Maven. --> @@ -98,5 +98,36 @@ <include name="${project.jar}" /> </fileset> </delete> <!-- Build Site --> <delete dir="${basedir}/site" /> <mkdir dir="${basedir}/site" /> <copy todir="${basedir}/site"> <fileset dir="${basedir}/src/com/gitblit/wicket/resources"> <include name="background.png" /> <include name="gitblit.css" /> <include name="markdown.css" /> <include name="gitblt_25.png" /> <include name="gitblt-favicon.png" /> </fileset> <fileset dir="${basedir}/docs"> <include name="*.png" /> </fileset> </copy> <java classpath="${project.build.dir}" classname="com.gitblit.BuildSite"> <classpath refid="master-classpath" /> <arg value="--sourceFolder" /> <arg value="${basedir}/docs" /> <arg value="--outputFolder" /> <arg value="${basedir}/site" /> <arg value="--pageHeader" /> <arg value="${basedir}/docs/page_header.html" /> <arg value="--pageFooter" /> <arg value="${basedir}/docs/page_footer.html" /> </java> </target> </project> distrib/gitblit.properties
@@ -146,11 +146,15 @@ server.httpsPort = 443 # Specify the interface for Jetty to bind the standard connector. # You may specify an ip or an empty value to bind to all interfaces. # You may specify an ip or an empty value to bind to all interfaces. # Specifying localhost will result in Git:Blit ONLY listening to requests to # localhost. server.httpBindInterface = localhost # Specify the interface for Jetty to bind the secure connector. # You may specify an ip or an empty value to bind to all interfaces. # Specifying localhost will result in Git:Blit ONLY listening to requests to # localhost. server.httpsBindInterface = localhost # Password for SSL keystore. distrib/installService.cmd
distrib/installService64.cmd
distrib/makekeystore.cmd
New file @@ -0,0 +1,2 @@ @del keystore @keytool -keystore keystore -alias localhost -genkey -keyalg RSA -dname "CN=localhost, OU=Git:Blit, O=Git:Blit, L=Some Town, ST=Some State, C=US" distrib/uninstallService.cmd
distrib/uninstallService64.cmd
docs/00_overview.mkd
New file @@ -0,0 +1,87 @@ ## Overview Git:Blit is an open-source, integrated pure-Java stack for managing, viewing, and serving [Git](http://git-scm.com) repositories. Its designed primarily as a tool for small workgroups who want to host Git repositories on a Windows machine. Of course, since its pure-Java it should run with any JVM on any platform, but there are already [many compelling Git solutions](https://git.wiki.kernel.org/index.php/InterfacesFrontendsAndTools) for non-Windows environments. ### Current Version [{0}](http://gitblit.com/{1}) based on [{2}](http://eclipse.org/jgit) (*{3}*) ### Features - Out-of-the-box integrated stack requiring minimal configuration - JGit SmartHTTP Servlet - Web and Git Servlet authentication - Four repository access control configurations - *Anonymous View, Clone & Push* - *Authenticated Push* - *Authenticated Clone & Push* - *Authenticated View, Clone & Push* - Gitweb inspired UI (mostly plain html) - Repository administration through web UI - User administration through web UI - Automatically generates a self-signed certificate for https communications - Dates can optionally be displayed using browser's reported timezone - Author and Committer email address display can be controlled - Syntax highlighting - Customizable regular expression handling for commit messages - Simple repository stats - Simple text file for server configuration - Simple text file for users configuration - Optional integrated Ticgit - Optional integrated Markdown ### Limitations - HTTP/HTTPS are the only supported protocols - Access controls are not path-based, they are repository-based - Only admin users can create repositories - Git:Blit is a full-stack solution, its not just a webapp so at this time there is no WAR build ### Todo List - Review spots where Git:Blit can cache data instead of abusing the disk - Ticgit activity/timeline - Ticgit query feature with paging support - Ticgit ticket change history - Implement Markdown editing - View images on Blob page - View other binary files Blob page ### License TBD ### Architecture  ### Bundled Dependencies The following dependencies are bundled with the Git:Blit zip file. - [google-code-prettify](http://code.google.com/p/google-code-prettify) - [JavaService](http://forge.ow2.org/projects/javaservice) - icons courtesy of [FatCow Hosting](http://www.fatcow.com/free-icons) ### Downloaded Dependencies The following dependencies are automatically downloaded from the Apache Maven repository and from the Eclipse Maven repository when Git:Blit is launched for the first time. - [JGit](http://eclipse.org/jgit) - [Wicket](http://wicket.apache.org) - [WicketStuff GoogleCharts](https://github.com/wicketstuff/core/wiki/GoogleCharts) - [MarkdownPapers](http://markdown.tautua.org) - [Jetty](http://eclipse.org/jetty) - [SLF4J](http://www.slf4j.org) - [Log4j](http://logging.apache.org/log4j) - [JCommander](http://jcommander.org) - [BouncyCastle](http://www.bouncycastle.org) ### Building Eclipse is recommended for development as the project settings are preconfigured. 1. Clone the git repository from here. 2. Import the gitblit project into your Eclipse workspace.<br/> *There will be lots of build errors.* 3. Using Ant, execute the `build.xml` script in the project root.<br/> *This will download all necessary build dependencies and will also generate the Keys class for accessing settings.* 4. Select your gitblit project root and **Refresh** the project, this should correct all build problems. 5. Review the settings in `gitblit.properties` in your project root.<br/> Make sure you set an appropriate value for *git.repositoriesFolder*. 6. Execute the *com.gitblit.Launcher* class to start Git:Blit. docs/01_configuration.mkd
New file @@ -0,0 +1,73 @@ ## Setup and Configuration 1. Download and unzip Git:Blit.<br/> *Its best to eliminate spaces in the path name as that can cause troubleshooting headaches.* 2. The server itself is configured through a simple text file.<br/> Open `gitblit.properties` in your favorite text editor and make sure to review and set: - *git.repositoryFolder* - *server.tempFolder* - *server.httpBindInterface* and *server.httpsBindInterface* - *server.storePassword*<br/> **NOTE:**<br/> Its recommended to use **https** wherever possible instead of http because passwords are transmitted as clear text! 3. Execute `gitblit.cmd` or `java -jar gitblit.jar` from a command-line 4. Wait a minute or two while all dependencies are downloaded and your self-signed certificate is generated. 5. Open your browser to <http://localhost> or <https://localhost> depending on your chosen configuration. 6. Click the *Login* link and enter the default administrator credentials: **admin / admin**<br/> **NOTE:**<br/> Make sure to change the administrator username and/or password!! ### Administering Repositories Repositories can be created, edited, and deleted through the web UI. They may also be created, edited, and deleted from the command-line using real Git or your favorite file manager and text editor. All repository settings are stored within the repository `.git/config` file under the *gitblit* section. [gitblit] description = master repository owner = Joe Owner useTickets = false useDocs = true showRemoteBranches = false accessRestriction = clone #### Repository Names Repository names must be unique and are case-insensitive. The name must be composed of letters, digits, or `/ _ - .`<br/> Whitespace is illegal. ### Administering Users In contrast, all users are stored in the `users.properties` file or in the file your specified in `gitblit.properties`.<br/> The format of `users.properties` follows Jetty's convention for HashRealms: username,password,role1,role2,role3... #### Usernames Usernames must be unique and are case-insensitive.<br/> Whitespace is illegal. #### Passwords User passwords are CASE-SENSITIVE and may be *plain*, *md5*, or *crypt* formatted (see `gitblit.properties` -> *realm.passwordStorage*). #### User Roles There is only one actual *role* in Git:Blit and that is *#admin* which grants administrative powers to that user. Administrators automatically have access to all repositories. All other *roles* are actually repository names. If a repository is access-restricted, the user must have the repository's name within his/her roles to bypass the access restriction. This is how users are granted access to a restricted repository. ### Creating your own Self-Signed Certificate Review the contents of the `makekeystore.cmd` or `makekeystore_jdk.cmd`script and execute it. Voila. ### Running as a Service Review the contents of the `installService.cmd` or `installService64.cmd`, as appropriate for your JVM.<br/> Set the *JDK* variable in the script to the location of your JDK, add any necessary start parameters, and execute the script. #### Command-Line Parameters --tempFolder Server temp folder --repositoriesFolder Git Repositories Folder --realmFile Users Realm Hash File --useNio Use NIO Connector else use Socket Connector. --httpPort HTTP port for to serve. (port <= 0 will disable this connector) --httpsPort HTTPS port to serve. (port <= 0 will disable this connector) --storePassword Password for SSL (https) keystore. --shutdownPort Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor) **Example** java -jar gitblit.jar --realmFile c:\myrealm.txt --storePassword something docs/01_eclipse.mkd
New file @@ -0,0 +1,5 @@ ## Eclipse Tips verifySsl how to push new unshared project to new repository docs/01_faq.mkd
New file @@ -0,0 +1 @@ ## Frequently Asked Questions docs/01_releases.mkd
New file @@ -0,0 +1 @@ ## Release History docs/01_screenshots.mkd
New file @@ -0,0 +1,3 @@ ## Screenshots  docs/architecture.odgBinary files differ
docs/architecture.png
docs/page_footer.html
New file @@ -0,0 +1,6 @@ </div> <div style="margin-top:10px" class="page_footer"> <div style="float:right;">{0}</div> </div> </body> </html> docs/page_header.html
New file @@ -0,0 +1,17 @@ <html> <head> <title>Git:Blit</title> <link rel="stylesheet" type="text/css" href="gitblit.css"/> <link rel="stylesheet" type="text/css" href="markdown.css"/> <link rel="shortcut icon" href="gitblt-favicon.png" type="image/png" /> <meta name="ROBOTS" content="INDEX, NOFOLLOW"> </head> <body> <div class="page_header"> <a title="gitblit homepage" href="http://gitblit.com/"> <img src="gitblt_25.png" width="79" height="25" alt="gitblit" class="logo"/> </a> <span style="color:black;">{0}</span> </div> <div class="page_nav">{1}</div> <div class="markdown"> src/com/gitblit/BuildSite.java
New file @@ -0,0 +1,136 @@ package com.gitblit; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilenameFilter; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.nio.charset.Charset; import java.text.MessageFormat; import java.text.SimpleDateFormat; import java.util.Arrays; import java.util.Date; import com.beust.jcommander.JCommander; import com.beust.jcommander.Parameter; import com.beust.jcommander.ParameterException; import com.beust.jcommander.Parameters; import com.gitblit.utils.MarkdownUtils; public class BuildSite { public static void main(String... args) { Params params = new Params(); JCommander jc = new JCommander(params); try { jc.parse(args); } catch (ParameterException t) { usage(jc, t); } File sourceFolder = new File(params.sourceFolder); File destinationFolder = new File(params.outputFolder); File[] markdownFiles = sourceFolder.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".mkd"); } }); Arrays.sort(markdownFiles); System.out.println(MessageFormat.format("Generating site from {0} Markdown Docs in {1} ", markdownFiles.length, sourceFolder.getAbsolutePath())); String linkPattern = "<a href=''{0}''>{1}</a>"; StringBuilder sb = new StringBuilder(); for (File file : markdownFiles) { String displayName = getDocumentName(file); String fileName = displayName + ".html"; sb.append(MessageFormat.format(linkPattern, fileName, displayName)); sb.append(" | "); } sb.setLength(sb.length() - 3); sb.trimToSize(); String html_header = readContent(new File(params.pageHeader)); String html_footer = readContent(new File(params.pageFooter)); final String links = sb.toString(); final String header = MessageFormat.format(html_header, Constants.FULL_NAME, links); final String date = new SimpleDateFormat("yyyy MMM dd").format(new Date()); final String footer = MessageFormat.format(html_footer, "generated " + date); for (File file : markdownFiles) { try { String displayName = getDocumentName(file); String fileName = displayName + ".html"; System.out.println(MessageFormat.format(" {0} => {1}", file.getName(), fileName)); InputStreamReader reader = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")); String content = MarkdownUtils.transformMarkdown(reader); if (displayName.equalsIgnoreCase("overview")) { content = MessageFormat.format(content, Constants.VERSION, "gitblit-" + Constants.VERSION + ".zip", Constants.getJGitVersion(), date); } OutputStreamWriter writer = new OutputStreamWriter(new FileOutputStream(new File(destinationFolder, fileName)), Charset.forName("UTF-8")); writer.write(header); writer.write(content); writer.write(footer); reader.close(); writer.close(); } catch (Throwable t) { System.err.println("Failed to transform " + file.getName()); t.printStackTrace(); } } } private static String readContent(File file) { StringBuilder sb = new StringBuilder(); try { InputStreamReader is = new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(is); String line = null; while ((line = reader.readLine()) != null) { sb.append(line); } reader.close(); } catch (Throwable t) { System.err.println("Failed to read content of " + file.getAbsolutePath()); t.printStackTrace(); } return sb.toString(); } private static String getDocumentName(File file) { String displayName = file.getName().substring(0, file.getName().lastIndexOf('.')).toLowerCase(); // trim leading ##_ which is to control display order return displayName.substring(3); } private static void usage(JCommander jc, ParameterException t) { System.out.println(Constants.getRunningVersion()); System.out.println(); if (t != null) { System.out.println(t.getMessage()); System.out.println(); } if (jc != null) { jc.usage(); } System.exit(0); } @Parameters(separators = " ") private static class Params { @Parameter(names = { "--sourceFolder" }, description = "Markdown Source Folder", required = true) public String sourceFolder; @Parameter(names = { "--outputFolder" }, description = "HTML Ouptut Folder", required = true) public String outputFolder; @Parameter(names = { "--pageHeader" }, description = "Page Header HTML Snippet", required = true) public String pageHeader; @Parameter(names = { "--pageFooter" }, description = "Page Footer HTML Snippet", required = true) public String pageFooter; } } src/com/gitblit/Constants.java
@@ -3,6 +3,8 @@ public class Constants { public final static String NAME = "Git:Blit"; public final static String FULL_NAME = "Git:Blit - a Pure Java Git Server"; // The build script extracts this exact line so be careful editing it // and only use A-Z a-z 0-9 .-_ in the string. src/com/gitblit/wicket/resources/markdown.css
@@ -3,6 +3,7 @@ */ div.markdown { line-height: 1.4em; } div.markdown h1, @@ -51,4 +52,16 @@ div.markdown a { text-decoration: underline; } div.markdown ul, div.markdown ol { padding-left: 30px; } div.markdown li { margin: 0.2em 0 0 0em; padding: 0px; } div.markdown em { color: #b05000; }