### Run Gitblit with Custom Parameters Source: http://gitblit.com/setup_go.html Example of starting the Gitblit JAR with specific configuration overrides. ```bash java -jar gitblit.jar --userService c:/myrealm.config --storePassword something --baseFolder c:/data ``` -------------------------------- ### Example Ticket Migration to Redis (Gitblit GO) Source: http://gitblit.com/tickets_replication.html Example of migrating tickets to a Redis ticket service using the migrate-tickets script. Ensure Redis settings are correctly configured. ```bash migrate-tickets com.gitblit.tickets.RedisTicketService c:\gitblit-data ``` -------------------------------- ### LIST_REPOSITORIES JSON Response Example Source: http://gitblit.com/rpc.html Example JSON response body for a LIST_REPOSITORIES request, returning a map of repository clone URLs to their respective model data. ```json { "https://localhost/git/libraries/xmlapache.git": { "name": "libraries/xmlapache.git", "description": "apache xmlrpc client and server", "owner": "admin", "lastChange": "2010-01-28T22:12:06Z", "hasCommits": true, "showRemoteBranches": false, "useTickets": false, "useDocs": false, "accessRestriction": "VIEW", "isFrozen": false, "showReadme": false, "federationStrategy": "FEDERATE_THIS", "federationSets": [ "libraries" ], "isFederated": false, "skipSizeCalculation": false, "skipSummaryMetrics": false, "size": "102 KB" }, "https://localhost/git/libraries/smack.git": { "name": "libraries/smack.git", "description": "smack xmpp client", "owner": "admin", "lastChange": "2009-01-28T18:38:14Z", "hasCommits": true, "showRemoteBranches": false, "useTickets": false, "useDocs": false, "accessRestriction": "VIEW", "isFrozen": false, "showReadme": false, "federationStrategy": "FEDERATE_THIS", "federationSets": [], "isFederated": false, "skipSizeCalculation": false, "skipSummaryMetrics": false, "size": "4.8 MB" } } ``` -------------------------------- ### Start Topic Branch Source: http://gitblit.com/tickets_barnum.html Commands to initialize a topic branch for future ticket proposals. ```bash pt start pt start ``` -------------------------------- ### GET /rpc/?req=LIST_SETTINGS Source: http://gitblit.com/rpc.html Retrieves the current server configuration settings. ```APIDOC ## GET /rpc/?req=LIST_SETTINGS ### Description Returns the current server settings, including default values and descriptions for each setting. ### Method GET ### Endpoint https://localhost/rpc/?req=LIST_SETTINGS ### Response #### Success Response (200) - **settings** (object) - A map of setting keys to their configuration details. #### Response Example { "settings": { "web.siteName": { "name": "web.siteName", "currentValue": "", "description": "Gitblit Web Settings" } } } ``` -------------------------------- ### Launch Gitblit GO Server Source: http://gitblit.com/setup_go.html Start the Gitblit GO server from the command line. Ensure the --baseFolder argument is provided if the data directory has been relocated. ```bash gitblit.cmd ``` ```bash java -jar gitblit.jar --baseFolder data ``` -------------------------------- ### Manual Mirror Setup and Cache Reset Source: http://gitblit.com/tickets_replication.html Commands to initialize a mirror, clear the repository cache, and trigger a ticket reindex via RPC. ```bash git clone --mirror curl --insecure --user admin:admin "https://localhost:8443/rpc?req=clear_repository_cache" curl --insecure --user admin:admin "https://localhost:8443/rpc?req=reindex_tickets&name=" ``` -------------------------------- ### Java Virtual Machine Path Configuration Source: http://gitblit.com/setup_go.html Example path for specifying the server JVM in the Windows service utility. ```text Java Virtual Machine: C:\Program Files\Java\jre6\bin\server\jvm.dll ``` -------------------------------- ### Configure Federation Pull Registrations Source: http://gitblit.com/federation.html Examples of federation pull registration settings to be added to the gitblit.properties file. ```properties federation.example1.url = https://go.gitblit.com federation.example1.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4 federation.example1.frequency = 120 mins federation.example1.folder = federation.example1.bare = true federation.example1.mirror = true federation.example1.mergeAccounts = true federation.example1.sendStatus = true ``` ```properties federation.example2.url = https://tomcat.gitblit.com/gitblit federation.example2.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4 federation.example2.frequency = 120 mins federation.example2.folder = example2 federation.example2.bare = true federation.example2.mirror = true ``` ```properties federation.example3.url = https://tomcat.gitblit.com/gitblit federation.example3.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4 federation.example3.frequency = 120 mins federation.example3.folder = example3 federation.example3.bare = true federation.example3.mirror = true federation.example3.exclude = somerepo.git ``` ```properties federation.example4.url = https://tomcat.gitblit.com/gitblit federation.example4.token = 6f3b8a24bf970f17289b234284c94f43eb42f0e4 federation.example4.frequency = 120 mins federation.example4.folder = example4 federation.example4.bare = true federation.example4.mirror = true federation.example4.exclude = * federation.example4.include = somerepo.git ``` -------------------------------- ### Start Topic Branch Source: http://gitblit.com/tickets_barnum.html Starts a new topic branch for development, either based on a ticket ID or a topic string. ```APIDOC ## Start Topic Branch ### Description The **start** command is used to start development of a topic branch that will eventually be pushed to a Ticket. You must specify what you are starting. If you specify a ticket id, the branch `topid/{id}` will be created. If you specify a topic string, the branch `topic/{topic}` will be created. The main difference will be how the **propose** command treats your branch name. ### Method POST ### Endpoint ``` pt start pt start ``` ### Parameters #### Path Parameters - **topic** (string) - Required - The topic string to create a branch for. - **id** (string) - Required - The ID of the ticket to create a branch for. ``` -------------------------------- ### Native Client SNI Error Example Source: http://gitblit.com/setup_transport_http.html Example of an error message displayed by native Git clients when encountering SNI issues. ```text C:\projects\git\gitblit>git push rhcloud master error: error:14077458:SSL routines:SSL23_GET_SERVER_HELLO:reason(1112) while accessing https://demo-gitblit.rhcloud.com/git/gitblit.git/info/refs?service=git-receive-pack fatal: HTTP request failed ``` -------------------------------- ### JGit Server Configuration for Large Installs Source: http://gitblit.com/setup_scaling.html Configure JVM heap and JGit server settings for large Gitblit or Gerrit installations. Adjust `packedGitLimit` to approximately 50% of JVM heap and ensure `ulimit` is configured for open files. ```properties -Xmx8g # gobs of JVM heap ``` ```properties # for `jgit daemon` or gerrit.config [core] packedGitLimit = 4g # around 50% of JVM heap packedGitOpenFiles = 8192 # don't forget to configure ulimit streamFileThreshold = 2047m # avoids pathological inflate deltaBaseCacheLimit = 50m # applies to `jgit gc` [pack] bigFileThreshold = 20m # don't delta compress big binaries indexVersion = 2 # use index v2 ``` -------------------------------- ### Example Distinguished Name (DN) Format Source: http://gitblit.com/setup_go.html Represents the structure of a distinguished name used in X509 certificates. ```text C=US,O=Gitblit,OU=Gitblit,CN=james ``` -------------------------------- ### Example Commit Message for Ticket Creation Source: http://gitblit.com/tickets_barnum.html Format for a single-commit message used to create a new ticket upon proposal. ```text Fix null pointer exception in StringUtils It is possible to throw a null pointer exception in the trim method. This can be triggered by yada, yada, yada. ``` -------------------------------- ### Run Gitblit Federation Client Source: http://gitblit.com/federation.html Execute the federation client with specified URL, mirror settings, and repository folder. This command runs once and quits. ```bash java -jar fedclient.jar --url https://go.gitblit.com --mirror --bare --token 123456789 --repositoriesFolder c:/mymirror ``` -------------------------------- ### EGit/JGit SSL Verification Error Example Source: http://gitblit.com/setup_go.html This is an example of an error message that may occur when remote Eclipse/EGit/JGit clients (versions < 3.0) attempt to communicate using a self-signed certificate that does not match the hostname. ```text Cannot get remote repository refs. Reason: https:/myserver.com/git/myrepo.git: cannot open git-upload-pack ``` -------------------------------- ### Configure PAM Authentication Source: http://gitblit.com/setup_authentication.html Enable PAM authentication and define the service name in gitblit.properties, then configure the corresponding PAM policy file. ```properties realm.authenticationProviders = pam realm.pam.serviceName = gitblit ``` ```text # PAM configuration for the gitblit service # Standard Un*x authentication. @include common-auth ``` -------------------------------- ### GET /rpc/?req=LIST_USERS Source: http://gitblit.com/rpc.html Retrieves a list of all users registered on the Gitblit server. ```APIDOC ## GET /rpc/?req=LIST_USERS ### Description Returns a list of all users and their associated permissions and repository access. ### Method GET ### Endpoint https://localhost/rpc/?req=LIST_USERS ### Response #### Success Response (200) - **username** (string) - The user's login name. - **canAdmin** (boolean) - Whether the user has administrative privileges. - **repositories** (array) - List of repositories the user has access to. #### Response Example [ { "username": "admin", "canAdmin": true, "repositories": [] } ] ``` -------------------------------- ### GET /rpc/?req=LIST_STATUS Source: http://gitblit.com/rpc.html Retrieves the current operational status and system information of the Gitblit server. ```APIDOC ## GET /rpc/?req=LIST_STATUS ### Description Returns server status information including boot date, version, and system properties. ### Method GET ### Endpoint https://localhost/rpc/?req=LIST_STATUS ### Response #### Success Response (200) - **version** (string) - The current Gitblit version. - **bootDate** (string) - The date and time the server started. - **systemProperties** (object) - JVM and OS system properties. #### Response Example { "bootDate": "2011-10-22T12:13:00Z", "version": "0.7.0-SNAPSHOT" } ``` -------------------------------- ### List Server Settings using LIST_SETTINGS RPC Source: http://gitblit.com/rpc.html The LIST_SETTINGS RPC retrieves all server configuration settings. Each setting includes its name, current value, default value, and a description. ```json { "settings": { "web.siteName": { "name": "web.siteName", "currentValue": "", "defaultValue": "", "description": "Gitblit Web Settings\nIf blank Gitblit is displayed.", "since": "0.5.0", "caseSensitive": false, "restartRequired": false, "spaceDelimited": false }, "web.summaryCommitCount": { "name": "web.summaryCommitCount", "currentValue": "16", "defaultValue": "16", "description": "The number of commits to display on the summary page\nValue must exceed 0 else default of 16 is used", "since": "0.5.0", "caseSensitive": false, "restartRequired": false, "spaceDelimited": false } } } ``` -------------------------------- ### Create a Proposal Ticket Source: http://gitblit.com/tickets_using.html Create a new ticket by pushing a single commit to the magic ref. ```bash git clone https://server/r/repo.git cd repo git checkout -b mytopic ...add a single commit... git push origin HEAD:refs/for/new # read ticket id from server output git branch -u origin/ticket/{id} ``` -------------------------------- ### Configure Htpasswd Authentication Source: http://gitblit.com/setup_authentication.html Enable Htpasswd authentication and provide the path to the user credentials file. ```properties realm.authenticationProviders = htpasswd realm.htpasswd.userFile = /path/to/htpasswd ``` -------------------------------- ### Clone Mirror for BranchTicketService Source: http://gitblit.com/tickets_replication.html Initial step to create a mirror of a source repository configured for BranchTicketService. ```bash git clone --mirror https://dev.gitblit.com/r/gitblit.git ``` -------------------------------- ### Run Gitblit Federation Client as a Daemon Source: http://gitblit.com/federation.html Execute the federation client as a daemon, pulling repositories at a specified frequency. This command allows for continuous operation. ```bash java -jar fedclient.jar --url https://go.gitblit.com --mirror --bare --token 123456789 --repositoriesFolder c:/mymirror --daemon --frequency "24 hours" ``` -------------------------------- ### Set Gitblit Canonical URL Source: http://gitblit.com/tickets_setup.html Configure the public URL for your Gitblit installation. This is essential for email notification links to function correctly. ```properties web.canonicalUrl = https://localhost:8443 ``` -------------------------------- ### Advertise Repository URLs Source: http://gitblit.com/setup_viewer.html Define advertised repository URLs for other Git serving solutions. Use {0} for the repository name and {1} for the username. ```properties web.otherUrls = ssh://localhost/git/{0} git://localhost:29418/git/{0} https://{1}@localhost/r/{0} ``` -------------------------------- ### Define Client App Integrations in clientapps.json Source: http://gitblit.com/setup_clientmenus.html Create a JSON array of objects in $(baseFolder}/clientapps.json to register new git clients or modify existing ones. Each entry specifies metadata, platform compatibility, and the clone URL pattern. ```json [ { "name": "SmartGit/Hg", "title": "syntevo SmartGit/Hg™", "description": "a Git client for Windows, Mac, & Linux", "legal": "© 2013 syntevo GmbH. All rights reserved.", "cloneUrl": "smartgit://cloneRepo/${repoUrl}", "productUrl": "http://www.syntevo.com/smartgithg", "platforms": [ "windows", "macintosh", "linux" ], "icon": "smartgithg_32x32.png", "isActive": true }, { "name": "GitHub", "title": "GitHub™ for Windows", "description": "a free Git client for Windows", "legal": "© 2013 GitHub. All rights reserved.", "cloneUrl": "github-windows://openRepo/${repoUrl}", "productUrl": "http://windows.github.com", "transports": [ "http", "https" ], "platforms": [ "windows" ], "icon": "github_32x32.png", "isActive": true }, { "name": "SparkleShare", "title": "SparkleShare™", "description": "an open source collaboration and sharing tool", "legal": "released under the GPLv3 open source license", "cloneUrl": "sparkleshare://addProject/${baseUrl}/sparkleshare/${repoUrl}.xml", "productUrl": "http://sparkleshare.org", "platforms": [ "windows", "macintosh", "linux" ], "icon": "sparkleshare_32x32.png", "minimumPermission" : "RW+", "isActive": false } ] ``` -------------------------------- ### Configure Custom User Service Source: http://gitblit.com/setup_authentication.html Integrate Gitblit with an existing environment by providing a custom IUserService implementation. Specify the fully qualified class name in the realm.userService setting. The custom service class must be on Gitblit's classpath and have a public default constructor. ```properties realm.userService = com.gitblit.IUserService ``` -------------------------------- ### Offline Ticket Reindexing (Gitblit GO) Source: http://gitblit.com/tickets_replication.html Execute the ReindexTickets tool from the Gitblit jar file for Gitblit GO installations. This must be run when Gitblit is offline. ```bash reindex-tickets ``` -------------------------------- ### Standard RSS Feed Query Source: http://gitblit.com/rpc.html Retrieve log/history information from a Gitblit repository branch using the RSS feed. Specify the repository, maximum entries, and starting ref. ```url https://localhost:8443/feed/gitblit.git?l=50&h=refs/heads/master ``` -------------------------------- ### Create New Patchset with Reviewers and Topic Source: http://gitblit.com/tickets_using.html Use this command to create a new patchset for a ticket, add reviewers, and set a topic that can be regex-matched against the repository's bugtraq configuration. ```git git push origin HEAD:refs/for/12%cc=james,cc=mark,t=JIRA-123 ``` -------------------------------- ### Configure Apache Proxy for Gitblit Source: http://gitblit.com/setup_proxy.html Sets up Apache as a transparent proxy to Gitblit. Adjust ProxyPass directives and X-Forwarded headers based on your Gitblit installation and SSL configuration. ```apache # Turn off support for true Proxy behaviour as we are acting as # a transparent proxy ProxyRequests Off # Turn off VIA header as we know where the requests are proxied ProxyVia Off # Turn on Host header preservation so that the servlet container # can write links with the correct host and rewriting can be avoided. # # This is important for all git push/pull/clone operations. ProxyPreserveHost On # Set the permissions for the proxy AddDefaultCharset off Order deny,allow Allow from all # The proxy context path must match the Gitblit context path. # For Gitblit GO, see server.contextPath in gitblit.properties. #ProxyPass /gitblit http://localhost:8080/gitblit #ProxyPassreverse /gitblit http://localhost:8080/gitblit # If your httpd frontend is https but you are proxying http Gitblit WAR or GO #Header edit Location ^http://([^/]+)/gitblit/ https://$1/gitblit/ # Additionally you will want to tell Gitblit the original scheme and port #RequestHeader set X-Forwarded-Proto https #RequestHeader set X-Forwarded-Port 443 # If you are using subdomain proxying then you will want to tell Gitblit the appropriate # context path for your repository url. # If you are not using subdomain proxying, then ignore this setting. #RequestHeader set X-Forwarded-Context / ``` -------------------------------- ### Create First Patchset for Existing Ticket Source: http://gitblit.com/tickets_using.html Push a patchset to an existing ticket using the ticket branch ref. ```bash git clone https://server/r/repo.git cd repo git checkout -b ticket/{id} ...add one or more commits... git push -u origin ticket/{id} ``` -------------------------------- ### Create Custom SSH Dispatch Command Source: http://gitblit.com/plugins_extensions.html Subclass DispatchCommand to create custom SSH command hierarchies. Register commands and nested dispatchers within the setup method. ```java import ro.fortsoft.pf4j.Extension; import org.kohsuke.args4j.Option; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.gitblit.transport.ssh.commands.CommandMetaData; import com.gitblit.transport.ssh.commands.DispatchCommand; import com.gitblit.transport.ssh.commands.UsageExample; @Extension @CommandMetaData(name = "mycommands", description = "Sample SSH dispatcher") public class MyDispatcher extends DispatchCommand { @Override protected void setup() { // commands in this dispatcher register(CommandA.class); register(CommandB.class); // nested dispatchers register(SubDispatcher1.class); register(SubDispatcher2.class); } @CommandMetaData(name = "commanda", aliases = { "ca" }, description = "description of command a") @UsageExample(syntax = "${cmd} --myflag", description = "description of commanda with --myflag") public static class CommandA extends SshCommand { protected final Logger log = LoggerFactory.getLogger(getClass()); @Option(name = "--myflag", aliases = { "-m" }, usage = "enable myflag") boolean myflag; @Override public void run() throws Failure { if (myflag) { log.info("Run with --myflag"); } else { log.info("Run without --myflag"); } } } } ``` -------------------------------- ### Configure users and teams in users.conf Source: http://gitblit.com/administration.html Defines user credentials, roles, and repository access permissions, as well as team memberships and associated repository access. ```ini [user "admin"] password = admin role = "#admin" role = "#notfederated" repository = RW+:repo1.git repository = RW+:repo2.git [user "hannibal"] password = bossman repository = RWD:topsecret.git repository = RW+:ateam/[A-Za-z0-9-~_\\./]+ [user "faceman"] password = vanity [user "murdock"] password = crazy [user "babaracus"] password = grrrr [team "ateam"] user = hannibal user = faceman user = murdock user = babaracus repository = RW:topsecret.git mailingList = list@ateam.org postReceiveScript = sendmail ``` -------------------------------- ### Launch Gitblit Authority with JAR Source: http://gitblit.com/setup_go.html Alternative method to launch the Gitblit Authority tool using its JAR file. The --baseFolder argument specifies the data directory. ```bash java -jar authority.jar --baseFolder data ``` -------------------------------- ### RSS Feed Query with Search Source: http://gitblit.com/rpc.html Search for specific terms within the commit log of a Gitblit repository branch using the RSS feed. Specify the repository, search string, and starting ref. ```url https://localhost:8443/feed/gitblit.git?l=50&h=refs/heads/master&s=documentation ``` -------------------------------- ### Configure Redmine Authentication Source: http://gitblit.com/setup_authentication.html Integrate Gitblit with a Redmine installation for user authentication. Ensure Redmine has API authentication enabled. This configuration only supports user authentication and does not create teams based on Redmine groups. ```properties realm.authenticationProviders = redmine realm.redmine.url = http://example.com/redmine ``` -------------------------------- ### Gitblit Command-Line Parameters Reference Source: http://gitblit.com/setup_go.html List of available command-line flags that override default settings in gitblit.properties. ```text --baseFolder The default base folder for all relative file reference settings --repositoriesFolder Git Repositories Folder --userService Authentication and Authorization Service (filename or fully qualified classname) --httpPort HTTP port for to serve. (port <= 0 will disable this connector) --httpsPort HTTPS port to serve. (port <= 0 will disable this connector) --sshPort SSH Daemon port to serve. (port <= 0 will disable this daemon) --gitPort Git Daemon port to serve. (port <= 0 will disable this daemon) --alias Alias in keystore of SSL cert to use for https serving --storePassword Password for SSL (https) keystore. --shutdownPort Port for Shutdown Monitor to listen on. (port <= 0 will disable this monitor) --dailyLogFile Redirect logging to a rolling, daily log file instead of stdout --tempFolder Folder for server to extract built-in webapp ``` -------------------------------- ### Configure Container Authentication Source: http://gitblit.com/setup_authentication.html Enable Gitblit to automatically create accounts for users authenticated by the servlet container when using the WAR deployment. This is useful when Gitblit is deployed within a pre-authenticated environment. ```properties realm.container.autoCreateAccounts = true ``` -------------------------------- ### Get Server Status using LIST_STATUS RPC Source: http://gitblit.com/rpc.html The LIST_STATUS RPC provides information about the Gitblit server's current state, including boot date, version, system properties, and memory usage. ```json { "bootDate": "2011-10-22T12:13:00Z", "version": "0.7.0-SNAPSHOT", "releaseDate": "PENDING", "isGO": true, "systemProperties": { "file.encoding": "Cp1252", "java.home": "C:\\Program Files\\Java\\jdk1.6.0_26\\jre", "java.io.tmpdir": "C:\\Users\\JAMESM~1\\AppData\\Local\\Temp\\", "java.runtime.name": "Java(TM) SE Runtime Environment", "java.runtime.version": "1.6.0_26-b03", "java.vendor": "Sun Microsystems Inc.", "java.version": "1.6.0_26", "java.vm.info": "mixed mode", "java.vm.name": "Java HotSpot(TM) 64-Bit Server VM", "java.vm.vendor": "Sun Microsystems Inc.", "java.vm.version": "20.1-b02", "os.arch": "amd64", "os.name": "Windows 7", "os.version": "6.1" }, "heapAllocated": 128057344, "heapFree": 120399168, "heapSize": 1899560960, "servletContainer": "jetty/7.4.3.v20110701" } ``` -------------------------------- ### Configure Windows Authentication Source: http://gitblit.com/setup_authentication.html Set the authentication provider to windows and specify the default domain in gitblit.properties. ```properties realm.authenticationProviders = windows realm.windows.defaultDomain = ``` -------------------------------- ### Enable Apache Proxy Modules Source: http://gitblit.com/setup_proxy.html Enables the necessary Apache proxy modules for Gitblit integration. Ensure these modules are available on your system. ```bash sudo su cd /etc/apache2/mods-enabled ln -s ../mods-available/proxy.load proxy.load ln -s ../mods-available/proxy_balancer.load proxy_balancer.load ln -s ../mods-available/proxy_http.load proxy_http.load ``` -------------------------------- ### Configure Salesforce.com Authentication Source: http://gitblit.com/setup_authentication.html Set up Gitblit to authenticate users against Salesforce.com. Optionally, restrict access to a specific organization by providing a non-zero organization ID. ```properties realm.authenticationProviders = salesforce realm.salesforce.orgId = 0 ``` -------------------------------- ### Implement a Server Lifecycle Listener Source: http://gitblit.com/plugins_extensions.html Subclass LifeCycleListener to execute logic during server startup and shutdown. ```java import org.slf4j.Logger; import org.slf4j.LoggerFactory; import ro.fortsoft.pf4j.Extension; import com.gitblit.extensions.LifeCycleListener; @Extension public class MyLifeCycleListener extends LifeCycleListener { final Logger log = LoggerFactory.getLogger(getClass()); @Override public void onStartup() { log.info("Gitblit is Ready!!"); } @Override public void onShutdown() { log.info("Gitblit is Going Down!!"); } } ``` -------------------------------- ### Configure Local Remote for Mirroring Source: http://gitblit.com/tickets_replication.html Adding a local Gitblit instance as a remote to the cloned mirror repository. ```bash cd gitblit.git git remote add local https://localhost:8443/gitblit.git ``` -------------------------------- ### Enable Gitblit RPC Servlet Source: http://gitblit.com/rpc.html Configure Gitblit to enable the RPC servlet for remote management. Ensure HTTPS is used for secure password transmission. ```properties web.enableRpcServlet=true web.enableRpcManagement=false web.enableRpcAdministration=false ``` -------------------------------- ### Clone Repository as Mirror Source: http://gitblit.com/setup_mirrors.html Use this native git command to clone an external repository as a mirror. Ensure you are in your git.repositoriesFolder or a designated subfolder. ```git git clone --mirror ``` -------------------------------- ### Configure Repository Settings Source: http://gitblit.com/administration.html Repository settings are stored in the .git/config file under the [gitblit] section. ```ini [gitblit] description = master repository owner = james useTickets = false useDocs = true showRemoteBranches = false accessRestriction = clone isFrozen = false showReadme = false federationStrategy = FEDERATE_THIS isFederated = false skipSizeCalculation = false federationSets = ``` -------------------------------- ### Configure Custom Authentication Provider Source: http://gitblit.com/setup_authentication.html Implement a custom username/password authentication mechanism by subclassing Gitblit's AuthenticationProvider.UsernamePasswordAuthenticationProvider. Specify the fully qualified class name in the realm settings. The custom class must be on Gitblit's classpath and have a public default constructor. ```properties realm.authenticationProviders = com.gitblit.auth.MyCustomAuthProvider ``` -------------------------------- ### Push Mirror to Local Gitblit Source: http://gitblit.com/tickets_replication.html Pushing all data, including ticket refs, to the local Gitblit instance. ```bash git push --mirror local ``` -------------------------------- ### Configure fail2ban jail for Gitblit Source: http://gitblit.com/setup_fail2ban.html Add the Gitblit service to the jail configuration to enable monitoring on specified ports. ```ini [gitblit] enabled = true port = 443,29418 protocol = tcp filter = gitblit logpath = /var/log/gitblit.log ``` -------------------------------- ### URL encoding for repository paths Source: http://gitblit.com/faq.html Comparison of incorrect and correct URL formatting for repository references containing forward slashes. ```text http://192.168.1.2/log/myrepo.git/refs/heads/master ``` ```text http://192.168.1.2/log/myrepo.git/refs%2Fheads%2Fmaster ``` -------------------------------- ### Using Grapes for Dependency Management Source: http://gitblit.com/setup_hooks.html Demonstrates how to use the @Grab annotation to include external Maven dependencies in a Groovy hook script. ```groovy // create and use a primitive array import org.apache.commons.collections.primitives.ArrayIntList @Grab(group='commons-primitives', module='commons-primitives', version='1.0') def createEmptyInts() { new ArrayIntList() } def ints = createEmptyInts() ints.add(0, 42) assert ints.size() == 1 assert ints.get(0) == 42 ``` -------------------------------- ### Gitblit JGit Configuration Equivalents Source: http://gitblit.com/setup_scaling.html These Gitblit settings are equivalents to the Gerrit JGit configurations for scaling. They control similar aspects of repository handling and performance. ```properties git.packedGitLimit = 4g git.packedGitOpenFiles = 8192 git.streamFileTreshold = 2047m git.deltaBaseCacheLimit = 50m ``` -------------------------------- ### List Users using LIST_USERS RPC Source: http://gitblit.com/rpc.html The LIST_USERS RPC returns a list of all users on the Gitblit server, including their credentials and repository access. ```json [ { "username": "admin", "password": "admin", "canAdmin": true, "excludeFromFederation": true, "repositories": [] }, { "username": "test", "password": "test", "canAdmin": false, "excludeFromFederation": false, "repositories": [ "libraries/xmlapache.git", "libraries/smack.git" ] } ] ```