### Git Bash Prompt Example
Source: https://support.codebasehq.com/articles/getting-started/git-on-windows
This is an example of the Git Bash prompt you will see after opening it from the start menu.
```bash
# Welcome to Git (version 1.7.0.2-preview20100309) # # Run 'git help git' to display the help index. # # Dan Wentworth@WIN ~ # $
```
--------------------------------
### Ruby API Example for Creating a Ticket
Source: https://support.codebasehq.com/kb/code-examples
This example demonstrates how to create a new ticket using Ruby's net/http library. It shows setting up the request, authentication, and sending the XML payload.
```Ruby
require 'uri'
require 'net/http'
# Create the request, set appropriate headers
url = URI.parse("http://api3.codebasehq.com/widgets/tickets")
req = Net::HTTP::Post.new(url.path)
req.basic_auth('account/dave', '6b2579a03c2e8825a5fd0a9b4390d15571f3674d')
req.add_field('Content-type', 'application/xml')
req.add_field('Accept', 'application/xml')
# Build our XML payload
xml = "My Example Ticket12341234bug"
# Send the request
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req, xml)}
case res
when Net::HTTPCreated
puts "Record was created successfully."
else
puts "An error occurred while adding this record"
end
```
--------------------------------
### Install Codebase4 Gem
Source: https://support.codebasehq.com/articles/tips-tricks/tracking-deployments
Install the Codebase4 gem on your local system. Alternatively, add `gem 'codebase4'` to your Gemfile if using Bundler.
```bash
[sudo] gem install codebase4
```
--------------------------------
### Install Mercurial using Homebrew
Source: https://support.codebasehq.com/articles/getting-started/mercurial-on-mac
Use this command in your terminal to install Mercurial if you have Homebrew set up.
```bash
$ brew install mercurial
```
--------------------------------
### Get All Deployment Keys for a Project (Text Format)
Source: https://support.codebasehq.com/kb/public-keys
Retrieves all deployment keys for a specific project, formatted as plain text.
```APIDOC
## GET /**project**/public_keys.txt
### Description
Retrieves all deployment keys for a given project in a plain text format.
### Method
GET
### Endpoint
/\**project\**/public_keys.txt
```
--------------------------------
### Get All Deployment Keys for a Project
Source: https://support.codebasehq.com/kb/public-keys
Retrieves all deployment keys associated with a specific project.
```APIDOC
## GET /**project**/public_keys
### Description
Retrieves all deployment keys for a given project.
### Method
GET
### Endpoint
/\**project\**/public_keys
```
--------------------------------
### Get All Projects
Source: https://support.codebasehq.com/kb/projects
Retrieves a list of all projects in the Codebase account.
```APIDOC
## GET /projects
### Description
Retrieves a list of all projects.
### Method
GET
### Endpoint
/projects
```
--------------------------------
### Get Specific Project
Source: https://support.codebasehq.com/kb/projects
Retrieves details for a specific project using its permalink.
```APIDOC
## GET /**project**
### Description
Retrieves details for a specific project.
### Method
GET
### Endpoint
/**project**
### Parameters
#### Path Parameters
- **project** (string) - Required - The permalink of the project to retrieve.
```
--------------------------------
### Ruby Syntax Highlighting Example
Source: https://support.codebasehq.com/articles/tips-tricks/syntax-highlighting-in-markdown
Use this format to display Ruby code with syntax highlighting. Ensure the language is specified after the opening markdown code fence.
```ruby
```ruby
def index
puts "hello world"
end
```
```
--------------------------------
### Create Ticket using Ruby net/http
Source: https://support.codebasehq.com/kb/code-examples
Use this Ruby example to create a new ticket via the Codebase API. It demonstrates setting up authentication, headers, and the XML payload for a POST request.
```ruby
require 'uri'
require 'net/http'
# Create the request, set appropriate headers
url = URI.parse("http://api3.codebasehq.com/widgets/tickets")
req = Net::HTTP::Post.new(url.path)
req.basic_auth('account/dave', '6b2579a03c2e8825a5fd0a9b4390d15571f3674d')
req.add_field('Content-type', 'application/xml')
req.add_field('Accept', 'application/xml')
# Build our XML payload
xml = "My Example Ticket12341234bug"
# Send the request
res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req, xml)}
case res
when Net::HTTPCreated
puts "Record was created successfully."
else
puts "An error occurred while adding this record"
end
```
--------------------------------
### Get All Deployment Keys for a Repository
Source: https://support.codebasehq.com/kb/public-keys
Retrieves all deployment keys associated with a specific repository within a project.
```APIDOC
## GET /**project** /**repository**/public_keys
### Description
Retrieves all deployment keys for a specific repository within a project.
### Method
GET
### Endpoint
/\**project\**/\**repository\**/public_keys
```
--------------------------------
### Capistrano Deployment Output with Codebase
Source: https://support.codebasehq.com/articles/tips-tricks/tracking-deployments
Example output seen during a Capistrano deployment after including the Codebase4 recipe, showing deployment information being sent to Codebase.
```bash
running: cb deploy fc10b3aa5a9e39ac326489805bba5c577f04db85 840daf31f4f87cb5cafd295ef75de989095f415b
-s localhost -b master -r test-repositories:git1 -h test.codebasehq.com --protocol https
Sending deployment information to test.codebasehq.com (project: 'test-repositories' repo: 'git1')
Commits......: fc10b3aa5a9e39ac326489805bba5c577f04db85 ... 840daf31f4f87cb5cafd295ef75de989095f415b
Environment..: - Branch.......: master Server(s)....: localhost Token........: lJ7KvCW******
Deployment added successfully
```
--------------------------------
### C# Syntax Highlighting Example
Source: https://support.codebasehq.com/articles/tips-tricks/syntax-highlighting-in-markdown
Use this format to display C# code with syntax highlighting. Ensure the language is specified after the opening markdown code fence.
```csharp
```csharp
private void index(){
MessageBox.Show("hello world");
}
```
```
--------------------------------
### Get All Wiki Pages
Source: https://support.codebasehq.com/kb/wiki
Retrieves all wiki pages within your project. This method allows you to download your entire wiki content.
```APIDOC
## GET /**project** /wiki/index
### Description
Retrieves all wiki pages in your project.
### Method
GET
### Endpoint
/**project** /wiki/index
```
--------------------------------
### GET Project Public Keys XML Response
Source: https://support.codebasehq.com/kb/public-keys
This XML structure is returned when retrieving public keys for a project. It includes the description and the key itself.
```xml
My Example Keyssh-rsa AAAAB3NzaC1yAAAQEAsAOV[...]Vs2TrWJkRNq5eJVw==
```
--------------------------------
### Clone Notebook Repository
Source: https://support.codebasehq.com/articles/notebook/editing-the-notebook-locally
Clone the remote notebook repository to your local machine using Git. Replace the example URL with your actual repository URL.
```bash
$ git clone git@codebasehq.com:your-account-domain/repository/path/notebook.git Cloning into notebook...
remote: Counting objects: 13, done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 13 (delta 0), reused 0 (delta 0)
Receiving objects: 100% (13/13), done.
```
--------------------------------
### Get Project Details (XML)
Source: https://support.codebasehq.com/kb/projects
This XML structure represents the default properties returned when accessing details for a specific project via the API.
```xml
1CodebaseaTech Mediacodebaseoverviewactive1003664
```
--------------------------------
### Get Repository Details (XML)
Source: https://support.codebasehq.com/kb/repositories
This XML structure represents the default properties returned when accessing details for a specific repository. It includes information like name, disk usage, and clone URL.
```xml
Gemgem45056057f5897e1c14631dbecfa29b647bef02cc631559git@codebasehq.com:account/codebase/gem.gitfalse
```
--------------------------------
### Get All Public Keys for a User (Text Format)
Source: https://support.codebasehq.com/kb/public-keys
Retrieves all public keys for a specific user, formatted as plain text.
```APIDOC
## GET /users/**username**/public_keys.txt
### Description
Retrieves all public keys for a given user in a plain text format.
### Method
GET
### Endpoint
/users/\**username\**/public_keys.txt
```
--------------------------------
### Successful SSH Authentication Message
Source: https://support.codebasehq.com/articles/getting-started/getting-started
This message confirms that your public key has been successfully uploaded and authenticated with Codebase. It also provides example commands for adding a remote and pushing repositories.
```text
You've successfully uploaded your public key to Codebase and authenticated.
Codebase does not, however, provide any direct SSH access.
Please use your SCM client to interact with your repositories.
The commands below may help you get started.
* git remote add origin git@codebasehq.com:account/project/repo.git
* git push origin master
* hg push ssh://hg@codebasehq.com:account/project/repo.hg
If you're having difficulties, please contact our friendly support team by emailing support@codebasehq.com.
Authenticated with key #108647
```
--------------------------------
### Initialize a Mercurial Repository
Source: https://support.codebasehq.com/articles/getting-started/mercurial-on-mac
Navigate to your project directory and initialize it as a Mercurial repository.
```bash
$ cd path/to/local/folder
```
```bash
$ hg init
```
--------------------------------
### Initialize New Mercurial Repository
Source: https://support.codebasehq.com/articles/repositories/pushing-to-a-repository
Initialize the current directory as a Mercurial repository.
```bash
$ hg init
```
--------------------------------
### GET /roles - Role Object Structure
Source: https://support.codebasehq.com/kb/user-management
Represents the structure of a role object returned by the GET /roles API endpoint. Includes role ID, name, default status, and permissions.
```xml
Trusted Users4trueprojects.read_all
```
--------------------------------
### Initialize New Git Repository
Source: https://support.codebasehq.com/articles/repositories/pushing-to-a-repository
Initialize Git in the current directory. This creates an empty Git repository.
```bash
$ git init
Initialized empty Git repository in path/to/local/folder
```
--------------------------------
### GET /users - User Object Structure
Source: https://support.codebasehq.com/kb/user-management
Represents the structure of a user object returned by the GET /users API endpoint. Includes details like API key, email, name, and assignments.
```xml
aabbccddeeffgghhiijjkkllmmnnooppqquser@example.com1WentworthDanLondondan1Awesome projectoverviewactiveawesome-projectWeb Apps1Project Awesomeoverviewactiveproject-awesometrue
```
--------------------------------
### Navigate to Project Directory
Source: https://support.codebasehq.com/articles/notebook/editing-the-notebook-locally
Change to the desired project directory in your terminal before cloning.
```bash
$ cd project
```
--------------------------------
### Test Codebase4 Token Configuration
Source: https://support.codebasehq.com/articles/tips-tricks/tracking-deployments
Verify that your access token has been added correctly by running this command.
```bash
cb test mydomain.codebasehq.com
```
--------------------------------
### Get All Watchers for a Ticket
Source: https://support.codebasehq.com/kb/tickets-and-milestones/watchers
Retrieves a list of all users who are currently watching a specific ticket.
```APIDOC
## GET /__project__ /tickets/__ticket_id__ /watchers
### Description
Retrieves a list of all users who are currently watching a specific ticket.
### Method
GET
### Endpoint
`/__project__/tickets/__ticket_id__/watchers`
### Parameters
#### Path Parameters
- **project** (string) - Required - The name of the project.
- **ticket_id** (integer) - Required - The ID of the ticket.
### Response
#### Success Response (200)
- **watchers** (array) - Contains a list of watcher IDs.
- **watcher** (integer) - The unique ID for a user watching the ticket.
### Response Example
```xml
321
```
```
--------------------------------
### Get All Tickets
Source: https://support.codebasehq.com/kb/tickets-and-milestones
Retrieves a list of all tickets within a project. Supports filtering with a search query.
```APIDOC
## GET /**project** /tickets
### Description
Retrieves a list of all tickets in the project.
### Method
GET
### Endpoint
/**project** /tickets
### Query Parameters
- **query** (string) - Optional - A search query to filter tickets.
```
```APIDOC
## GET /**project** /tickets?query=**query**
### Description
Retrieves a list of all tickets in the project that match the provided search query.
### Method
GET
### Endpoint
/**project** /tickets
### Query Parameters
- **query** (string) - Required - The search query to filter tickets.
```
--------------------------------
### Log a Deployment Manually
Source: https://support.codebasehq.com/articles/tips-tricks/tracking-deployments
Build a `cb deploy` command to log a deployment. Include the old and new revision references, and optional switches for servers, environment, branch, repository, and protocol.
```bash
cb deploy [old revision ref] [new revision ref]
```
```bash
cb deploy 531eca5 9de177c -s app1.mydomain.com,app2.mydomain.com
-e production -b master
-h mydomain.codebasehq.com
-r awesomeproject:myrepo
--protocol https
```
--------------------------------
### Backup All GIT Repositories with PHP
Source: https://support.codebasehq.com/kb/code-examples/php-backup-git-repositories
This script requires API credentials and local directory paths to be configured. It fetches project and repository data via the CodebaseHQ API and clones each repository. Ensure the API user and password are set correctly and the backup directories exist.
```php
*
*/
define('API_URL', 'https://api3.codebasehq.com/');
define('API_USER', '');
define('API_PASSWD', '');
define('BACKUP_TO', '/storage/'); // Dir destination
define('DIR_TMP', '/storage/backup_cb/'); // Temp dir to git clones
exec('rm -Rf ' . DIR_TMP . '*');
$projects = request_api('projects');
foreach($projects->project as $p){
mkdir(DIR_TMP . $p->permalink);
$repos = request_api($p->permalink . '/repositories');
foreach($repos->repository as $r){
$r = (Array)$r;
exec("git clone --mirror {$r['clone-url']} " . DIR_TMP . $p->permalink . '/' . $r['permalink'] . '.repo");
}
}
$date = date('Ymd');
exec("cd " . DIR_TMP . "; tar czf " . BACKUP_TO . "codebase_{$date}.tar.gz *");
function request_api($method, $parse_xml = true){
$ch = curl_init(API_URL . $method);
curl_setopt($ch, CURLOPT_USERPWD, API_USER . ':' . API_PASSWD);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$ret = curl_exec($ch);
curl_close($ch);
if($parse_xml == true){
$ret = simplexml_load_string($ret);
}
return $ret;
}
```
--------------------------------
### Get All Categories
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available categories for a project. Requires read access to tickets.
```APIDOC
## GET /_project_ /tickets/categories
### Description
Retrieves a list of all available categories for a project.
### Method
GET
### Endpoint
`/_project_/tickets/categories`
### Response
#### Success Response (200)
- **ticketing-category** (object) - Contains details of a category including id and name.
### Response Example
```xml
3351Cosmetic
```
```
--------------------------------
### Get All Priorities
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available priorities for a project. Requires read access to tickets.
```APIDOC
## GET /_project_ /tickets/priorities
### Description
Retrieves a list of all available priorities for a project.
### Method
GET
### Endpoint
`/_project_/tickets/priorities`
### Response
#### Success Response (200)
- **ticketing-priority** (object) - Contains details of a priority including id, name, colour, default, and position.
### Response Example
```xml
3300Low666666false4
```
```
--------------------------------
### Create Project File with Ruby/Faraday
Source: https://support.codebasehq.com/kb/code-examples/ruby-faraday-add-project-file
After uploading the file and obtaining the token, use this snippet to create the file entry within your project. This requires the project permalink and the file upload token obtained from the previous step.
```ruby
payload = JSON.dump({ :name => "My screenshot", :description => 'shows the broken thing', :file_upload_token => token })
response = connection.post "/#{PROJECT_PERMALINK}/files" do
req.body = payload
req.headers['Accept'] = 'application/json'
req.headers['Content-Type'] = 'application/json'
end
```
--------------------------------
### Get All Statuses
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available statuses for a project. Requires read access to tickets.
```APIDOC
## GET /_project_ /tickets/statuses
### Description
Retrieves a list of all available statuses for a project.
### Method
GET
### Endpoint
`/_project_/tickets/statuses`
### Response
#### Success Response (200)
- **ticketing-status** (object) - Contains details of a status including id, name, background-colour, order, and treat-as-closed.
### Response Example
```xml
6674New9ac1301false
```
```
--------------------------------
### Get All Public Keys for a User
Source: https://support.codebasehq.com/kb/public-keys
Retrieves all public keys associated with a specific user account.
```APIDOC
## GET /users/**username**/public_keys
### Description
Retrieves all public keys for a given user.
### Method
GET
### Endpoint
/users/\**username\**/public_keys
```
--------------------------------
### Create Project
Source: https://support.codebasehq.com/kb/projects
Creates a new project in the Codebase account.
```APIDOC
## POST /create_project
### Description
Creates a new project.
### Method
POST
### Endpoint
/create_project
### Request Body
- **name** (string) - Required - The name of the new project.
### Request Example
```xml
My new project
```
```
--------------------------------
### Get Time Sessions Added This Month
Source: https://support.codebasehq.com/kb/time-tracking
Retrieves all time sessions that were added this month for the specified project.
```APIDOC
## GET /__project__/time_sessions/month
### Description
Retrieves all time sessions recorded for the current month within a project.
### Method
GET
### Endpoint
/__project__/time_sessions/month
### Response
#### Success Response (200)
Returns a list of time sessions in the same format as the 'All time sessions for a project' endpoint.
```
--------------------------------
### Get Time Sessions Added This Week
Source: https://support.codebasehq.com/kb/time-tracking
Retrieves all time sessions that were added this week for the specified project.
```APIDOC
## GET /__project__/time_sessions/week
### Description
Retrieves all time sessions recorded for the current week within a project.
### Method
GET
### Endpoint
/__project__/time_sessions/week
### Response
#### Success Response (200)
Returns a list of time sessions in the same format as the 'All time sessions for a project' endpoint.
```
--------------------------------
### List Repository Contents
Source: https://support.codebasehq.com/articles/notebook/editing-the-notebook-locally
Verify that the notebook repository has been cloned successfully by listing its contents.
```bash
$ ls Example Page.md Instructions.md
```
--------------------------------
### Get Time Sessions Added Today
Source: https://support.codebasehq.com/kb/time-tracking
Retrieves all time sessions that were added today for the specified project.
```APIDOC
## GET /__project__/time_sessions/day
### Description
Retrieves all time sessions recorded for the current day within a project.
### Method
GET
### Endpoint
/__project__/time_sessions/day
### Response
#### Success Response (200)
Returns a list of time sessions in the same format as the 'All time sessions for a project' endpoint.
```
--------------------------------
### Get All Types
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available ticket types for a project. Requires read access to tickets.
```APIDOC
## GET /_project_ /tickets/types
### Description
Retrieves a list of all available ticket types for a project.
### Method
GET
### Endpoint
`/_project_/tickets/types`
### Response
#### Success Response (200)
- **ticketing-types** (array) - An array of ticketing-type objects, each containing id, name, and icon.
### Response Example
```xml
1904887Bugbug1904890Enhancementhat1904893Featureconstruction1904896Tasktask
```
```
--------------------------------
### Creating a New Ticket with Description (POST /tickets)
Source: https://support.codebasehq.com/kb/tickets-and-milestones
Demonstrates how to create a new ticket, including setting an initial description using CDATA tags for XML-safe characters. This method is used for the POST request to the tickets endpoint.
```xml
My new ticket
```
--------------------------------
### Get Individual File Details
Source: https://support.codebasehq.com/kb/file-storage
Retrieves detailed information about a specific file using its unique identifier.
```APIDOC
## GET /**project** /files/**identifier**
### Description
Retrieves detailed information for a specific file.
### Method
GET
### Endpoint
/**project** /files/**identifier**
### Parameters
#### Path Parameters
- **identifier** (string) - Required - The unique identifier of the file.
```
--------------------------------
### Add and Commit Files in Mercurial
Source: https://support.codebasehq.com/articles/getting-started/mercurial-on-mac
Stage all files in the repository and make the initial commit.
```bash
$ hg add
$ hg commit -m "Initial commit"
```
--------------------------------
### Get All Ticket Types
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available ticket types for a project. Requires read access to tickets.
```xml
1904887Bugbug1904890Enhancementhat1904893Featureconstruction1904896Tasktask
```
--------------------------------
### Get All Ticket Categories
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available ticket categories for a project. Requires read access to tickets.
```xml
3351Cosmetic
```
--------------------------------
### Create Deployment
Source: https://support.codebasehq.com/kb/repositories/deployments
Submit XML data to this endpoint to create a new deployment. This action will update your activity feed and trigger post-deployment activities. Requests must be authenticated using your username and API key.
```APIDOC
## POST /_project_ /_repository_ /deployments
### Description
Creates a new deployment record for a repository.
### Method
POST
### Endpoint
/_project_ /_repository_ /deployments
### Parameters
#### Request Body
- **branch** (string) - Required - The branch which you are deploying.
- **revision** (string) - Required - The reference of the revision/commit you are deploying. This must already exist in your repository and have been pushed to Codebase.
- **environment** (string) - Optional - The environment you are pushing to (used for reference only).
- **servers** (string) - Required - List of servers which you are deploying to (multiple servers should be comma separated, e.g. `app1.myapp.com, app2.myapp.com, app3.myapp.com`).
### Request Example
```xml
masterdeac8ba2675d6da4c8c9df4525da0a92fcea6c1aproductionapp.myapp.com
```
### Response
#### Success Response (200)
- **status** (string) - Indicates the success of the operation.
#### Response Example
```json
{
"deployment": {
"status": "created"
}
}
```
```
--------------------------------
### Get All Ticket Priorities
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available ticket priorities for a project. Requires read access to tickets.
```xml
3300Low666666false4
```
--------------------------------
### Add and Commit Changes
Source: https://support.codebasehq.com/articles/notebook/editing-the-notebook-locally
Stage all modified files and commit them with a descriptive message.
```bash
$ git add . $ git commit -m 'Update Notebook' [default 9595858] Update Notebook
1 files changed, 3 insertions(+), 1 deletions(-)
```
--------------------------------
### Get All Ticket Statuses
Source: https://support.codebasehq.com/kb/tickets-and-milestones/statuses-priorities-and-categories
Retrieves a list of all available ticket statuses for a project. Requires read access to tickets.
```xml
6674New9ac1301false
```
--------------------------------
### Creating a new user
Source: https://support.codebasehq.com/kb/user-management
Invites a new user to the system by providing their name and email address. An optional role ID can be specified.
```APIDOC
## POST /users
### Description
Invites a new user to the system. The user will receive an email with an invite link to complete signup. Requires first name, last name, and email address. Optionally, a role ID can be provided.
### Method
POST
### Endpoint
/users
### Request Body
- **first-name** (string) - Required - User's first name
- **last-name** (string) - Required - User's last name
- **email-address** (string) - Required - User's primary e-mail address
- **role-id** (integer) - Optional - The ID of the role to assign to the new user
```
--------------------------------
### Add and Commit Files in Git
Source: https://support.codebasehq.com/articles/repositories/pushing-to-a-repository
Stage all files in the current directory for commit and then commit them with a message. This is typically the first commit for a new repository.
```bash
$ git add .
$ git commit -m 'initial commit'
[master (root-commit) 5cc0002]
initial commit 0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
```
--------------------------------
### Get All Commits for a Specific Ref
Source: https://support.codebasehq.com/kb/repositories/commits
Retrieves a list of all commits for a given repository reference (branch, tag, or commit).
```APIDOC
## GET /_project_ /_repository_ /commits/_ref_
### Description
Retrieves all commits for a specific repository reference.
### Method
GET
### Endpoint
`/_project_ /_repository_ /commits/_ref_`
### Parameters
#### Path Parameters
- **project** (string) - Required - The name of the project.
- **repository** (string) - Required - The name of the repository.
- **ref** (string) - Required - The branch name, tag name, or commit reference.
### Response
#### Success Response (200)
Returns an array of commit objects. Each commit object contains details such as ref, message, author-name, author-email, authored-at, committer-name, committer-email, committed-at, parent-refs, tree-ref, author-user, and committer-user.
```
--------------------------------
### Create a new repository
Source: https://support.codebasehq.com/kb/repositories
Creates a new repository within a specified project. You need to provide the repository's name and SCM type.
```APIDOC
## POST /_project_ /repositories
### Description
Creates a new repository within a specified project. Requires the project's permalink in the URL.
### Method
POST
### Endpoint
`/_project_ /repositories`
### Parameters
#### Path Parameters
- **project** (string) - Required - The permalink of the project.
#### Request Body
- **name** (string) - Required - The name of the repository.
- **scm** (string) - Required - The SCM type (e.g., git).
- **permalink** (string) - Optional - The permalink for the repository.
```
--------------------------------
### Create Project Payload (XML)
Source: https://support.codebasehq.com/kb/projects
To create a new project, send a POST request to the /create_project endpoint with a payload containing the project's name.
```xml
My new project
```
--------------------------------
### Configure Git User Information
Source: https://support.codebasehq.com/articles/repositories/pushing-to-a-repository
Set your username and email for Git commits. Replace 'username' and 'email' with your actual information.
```bash
$ git config --global user.name "username"
$ git config --global user.email "email"
```
--------------------------------
### Get All Hooks on a Repository
Source: https://support.codebasehq.com/kb/repositories/hooks
Retrieves a list of all configured hooks for a specific repository. This is useful for auditing or managing existing hooks.
```APIDOC
## GET /**project** /**repository** /hooks
### Description
Retrieves all hooks associated with a specific repository.
### Method
GET
### Endpoint
/**project** /**repository** /hooks
### Response
#### Success Response (200)
- **repository-hook** (object) - A list of repository hook objects.
### Response Example
```json
{
"hooks": [
{
"id": 4,
"url": "http://paste.codebasehq.com/pastes/8qpw1f8u3totu8yzn5",
"username": "dan",
"password": "danspassword"
}
]
}
```
```
--------------------------------
### List Existing SSH Keys
Source: https://support.codebasehq.com/articles/getting-started/getting-started
Check your system for existing SSH keys by listing the files in the .ssh directory. This helps determine if you need to generate a new key.
```bash
$ ls ~/.ssh # Lists the files in your ~/.ssh directory
```