Create Git Credential
Create a stored HTTPS credential for a repository configured with a generic Git upstream.
JWT claims
Required scopes: repo:write
Requires per repo scope: Yes
Deprecated: Use /api/repos/{repo_name}/git-credentials instead.
curl --request POST \
--url https://api.{cluster}.code.storage/api/v1/repos/git-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"password": "glpat_xxxxxxxxxxxx",
"repo_id": "repo_7f2b3d9",
"username": "git"
}
'import requests
url = "https://api.{cluster}.code.storage/api/v1/repos/git-credentials"
payload = {
"password": "glpat_xxxxxxxxxxxx",
"repo_id": "repo_7f2b3d9",
"username": "git"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({password: 'glpat_xxxxxxxxxxxx', repo_id: 'repo_7f2b3d9', username: 'git'})
};
fetch('https://api.{cluster}.code.storage/api/v1/repos/git-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.{cluster}.code.storage/api/v1/repos/git-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'password' => 'glpat_xxxxxxxxxxxx',
'repo_id' => 'repo_7f2b3d9',
'username' => 'git'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{cluster}.code.storage/api/v1/repos/git-credentials"
payload := strings.NewReader("{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{cluster}.code.storage/api/v1/repos/git-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{cluster}.code.storage/api/v1/repos/git-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2026-03-12T15:04:05Z",
"id": "ggc_1234567890abcdef"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Store HTTPS credentials for a generic Git upstream such as GitLab, Bitbucket, Gitea, Forgejo, Codeberg, or SourceHut.
Request body for storing a new HTTPS Git credential against a repository configured for a generic Git provider.
Password or access token for the upstream provider.
"glpat_xxxxxxxxxxxx"
Repository identifier returned when the repository was created.
"repo_7f2b3d9"
Optional username for HTTPS authentication. Omit it for token-only providers.
"git"
Response
Credential created successfully.
curl --request POST \
--url https://api.{cluster}.code.storage/api/v1/repos/git-credentials \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"password": "glpat_xxxxxxxxxxxx",
"repo_id": "repo_7f2b3d9",
"username": "git"
}
'import requests
url = "https://api.{cluster}.code.storage/api/v1/repos/git-credentials"
payload = {
"password": "glpat_xxxxxxxxxxxx",
"repo_id": "repo_7f2b3d9",
"username": "git"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({password: 'glpat_xxxxxxxxxxxx', repo_id: 'repo_7f2b3d9', username: 'git'})
};
fetch('https://api.{cluster}.code.storage/api/v1/repos/git-credentials', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.{cluster}.code.storage/api/v1/repos/git-credentials",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'password' => 'glpat_xxxxxxxxxxxx',
'repo_id' => 'repo_7f2b3d9',
'username' => 'git'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.{cluster}.code.storage/api/v1/repos/git-credentials"
payload := strings.NewReader("{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.{cluster}.code.storage/api/v1/repos/git-credentials")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.{cluster}.code.storage/api/v1/repos/git-credentials")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"password\": \"glpat_xxxxxxxxxxxx\",\n \"repo_id\": \"repo_7f2b3d9\",\n \"username\": \"git\"\n}"
response = http.request(request)
puts response.read_body{
"created_at": "2026-03-12T15:04:05Z",
"id": "ggc_1234567890abcdef"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}{
"status": 123,
"title": "<string>",
"type": "<string>",
"detail": "<string>",
"error": "<string>",
"instance": "<string>"
}