SINCE 0.7.0
Gitblit optionally allows a remote client to administer the Gitblit server. This client could be a Java-based tool or perhaps a tool written in another language.
web.enableRpcServlet=true
web.enableRpcManagement=false
web.enableRpcAdministration=false
https is strongly recommended because passwords are insecurely transmitted form your browser/rpc client using Basic authentication!
The Gitblit JSON RPC mechanism, like the Gitblit JGit servlet, syndication/feed servlet, etc, supports request-based authentication. Making an admin request will trigger Gitblit's basic authentication mechanism. Listing of repositories, generally, will not trigger this authentication mechanism unless web.authenticateViewPages=true. That means its possible to allow anonymous enumeration of repositories that are not view restricted or clone restricted. Of course, if credentials are provided then all private repositories that are available to the user account will be enumerated in the JSON response.
The Gitblit Manager is an example Java/Swing application that allows remote management (repository and user objects) and administration (server settings) of a Gitblit server.
This application uses a combination of RSS feeds and the JSON RPC interface, both of which are part of the Gitblit API library, to present live information from a Gitblit server. Some JSON RPC methods from the utility class com.gitblit.utils.RpcUtils
are not currently used by the Gitblit Manager.
NOTE:
Gitblit Manager stores your login credentials INSECURELY in homedir/.gitblit/config.
At present, Gitblit does not yet support retrieving Git objects (commits, etc) via the JSON RPC mechanism. However, the repository/branch RSS feeds can be used to extract log/history information from a repository branch.
The Gitblit API includes methods for retrieving and interpreting RSS feeds. The Gitblit Manager uses these methods to allow branch activity monitoring and repository searching.
url parameter | default | description |
---|---|---|
standard query | ||
repository | required | repository name is part of the url (see examples below) |
ot= | optional default: COMMIT | object type to return in results. COMMIT or TAG |
h= | optional default: HEAD | starting branch, ref, or commit id |
l= | optional default: web.syndicationEntries | maximum return count |
pg= | optional default: 0 | page number for paging (offset into history = pagenumber*maximum return count) |
search query | ||
s= | required | search string |
st= | optional default: COMMIT | search type |
https://localhost:8443/feed/gitblit.git?l=50&h=refs/heads/master
https://localhost:8443/feed/gitblit.git?l=50&h=refs/heads/master&s=documentation
https://localhost:8443/feed/gitblit.git?l=50&h=refs/heads/master&s=james&st=author&pg=2
Release | Protocol Version |
---|---|
Gitblit v0.7.0 | 1 (inferred version) |
Gitblit v0.8.0 | 2 |
Gitblit v0.9.0 - v1.0.0 | 3 |
Gitblit v1.1.0 | 4 |
Gitblit v1.2.0 | 5 |
Gitblit v1.3.1 | 6 |
Gitblit v1.4.0 | 7 |
Gitblit v1.6.0 | 8 |
url parameters | required user permission | protocol version | json | ||
---|---|---|---|---|---|
req= | name= | post body | response body | ||
web.enableRpcServlet=true | |||||
GET_PROTOCOL | - | - | 2 | - | Integer |
LIST_REPOSITORIES | - | - | 1 | - | Map<String, RepositoryModel> |
LIST_BRANCHES | - | - | 1 | - | Map<String, List<String>> |
LIST_SETTINGS | - | - | 1 | - | ServerSettings (basic keys) |
GET_USER | user name | - | 6 | - | UserModel |
FORK_REPOSITORY | repository name | - | 8 | - | - |
web.enableRpcManagement=true | |||||
CREATE_REPOSITORY | repository name | admin | 1 | RepositoryModel | - |
EDIT_REPOSITORY | repository name | admin | 1 | RepositoryModel | - |
DELETE_REPOSITORY | repository name | admin | 1 | RepositoryModel | - |
LIST_USERS | - | admin | 1 | - | List<UserModel> |
CREATE_USER | user name | admin | 1 | UserModel | - |
EDIT_USER | user name | admin | 1 | UserModel | - |
DELETE_USER | user name | admin | 1 | UserModel | - |
LIST_TEAMS | - | admin | 2 | - | List<TeamModel> |
CREATE_TEAM | team name | admin | 2 | TeamModel | - |
EDIT_TEAM | team name | admin | 2 | TeamModel | - |
DELETE_TEAM | team name | admin | 2 | TeamModel | - |
LIST_REPOSITORY_MEMBERS | repository name | admin | 1 | - | List<String> |
- | |||||
LIST_REPOSITORY_MEMBER_PERMISSIONS | repository name | admin | 5 | - | List<String> |
SET_REPOSITORY_MEMBER_PERMISSIONS | repository name | admin | 5 | List<String> | - |
LIST_REPOSITORY_TEAMS | repository name | admin | 2 | - | List<String> |
- | |||||
LIST_REPOSITORY_TEAM_PERMISSIONS | repository name | admin | 5 | - | List<String> |
SET_REPOSITORY_TEAM_PERMISSIONS | repository name | admin | 5 | List<String> | - |
LIST_SETTINGS | - | admin | 1 | - | ServerSettings (management keys) |
CLEAR_REPOSITORY_CACHE | - | - | 4 | - | - |
REINDEX_TICKETS | repository name | - | 7 | - | - |
web.enableRpcAdministration=true | |||||
LIST_FEDERATION_REGISTRATIONS | - | admin | 1 | - | List<FederationModel> |
LIST_FEDERATION_RESULTS | - | admin | 1 | - | List<FederationModel> |
LIST_FEDERATION_PROPOSALS | - | admin | 1 | - | List<FederationProposal> |
LIST_FEDERATION_SETS | - | admin | 1 | - | List<FederationSet> |
LIST_SETTINGS | - | admin | 1 | - | ServerSettings (all keys) |
EDIT_SETTINGS | - | admin | 1 | Map<String, String> | - |
LIST_STATUS | - | admin | 1 | - | ServerStatus (see example below) |
code | name | description |
---|---|---|
200 | success | Gitblit processed the request successfully |
401 | unauthorized | Gitblit requires user credentials to process the request |
403 | forbidden | Gitblit can not process the request for the supplied credentials |
405 | method not allowed | Gitblit has disallowed the processing the specified request |
500 | server error | Gitblit failed to process the request likely because the input object created a conflict |
501 | unknown request | Gitblit does not recognize the RPC request type |
url: https://localhost/rpc/?req=LIST_REPOSITORIES
response body: Map<String, RepositoryModel> where the map key is the clone url of the repository
{ "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" } }
The original repository name is specified in the name url parameter. The new name is set within the JSON object.
url: https://localhost/rpc/?req=EDIT_REPOSITORY&name=libraries/xmlapache.git
post body: RepositoryModel
{ "name": "libraries/xmlapache-renamed.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" }
url: https://localhost/rpc/?req=LIST_USERS
response body: List<UserModel>
[ { "username": "admin", "password": "admin", "canAdmin": true, "excludeFromFederation": true, "repositories": [] }, { "username": "test", "password": "test", "canAdmin": false, "excludeFromFederation": false, "repositories": [ "libraries/xmlapache.git", "libraries/smack.git" ] } ]
url: https://localhost/rpc/?req=LIST_SETTINGS
response body: ServerSettings
{ "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 } } }
url: https://localhost/rpc/?req=LIST_STATUS
response body: ServerStatus
{ "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" }