---
title: "Update a stack's Git configs"
method: POST
path: "/stacks/{id}/git"
tags: ["stacks"]
---

# Update a stack's Git configs

`POST /stacks/{id}/git`

Update the Git settings in a stack, e.g., RepositoryReferenceName and AutoUpdate. When SourceID is set, URL/auth/TLS are taken from the referenced Source.
**Access policy**: authenticated

## Path parameters

- `id` integer, required

## Query parameters

- `endpointId` integer

## Request body

- StacksStackGitUpdatePayload
  - `AdditionalFiles` string[]
  - `AutoUpdate` PortainerAutoUpdateSettings
    - `ForcePullImage` boolean — Pull latest image
    - `ForceUpdate` boolean — Force update ignores repo changes
    - `Interval` string — Auto update interval Deprecated: polling interval now lives on the associated Source (Source.Interval). Kept for DB backwards-compatibility only; new code must not read or write this field.
    - `JobID` string — Autoupdate job id
    - `Webhook` string — A UUID generated from client
  - `ConfigFilePath` string
  - `Env` PortainerPair[]
    - `name` string, required
    - `value` string, required
  - `Prune` boolean
  - `RepositoryAuthentication` boolean — Deprecated: use SourceID instead. Use basic authentication to clone the Git repository.
  - `RepositoryPassword` string — Deprecated: use SourceID instead. Password used in basic authentication.
  - `RepositoryReferenceName` string
  - `RepositoryURL` string — Deprecated: use SourceID instead. URL of a Git repository hosting the Stack file.
  - `RepositoryUsername` string — Deprecated: use SourceID instead. Username used in basic authentication.
  - `SourceID` integer — SourceID references an existing Source for git credentials/URL. When set, the inline URL and authentication fields are ignored.
  - `TLSSkipVerify` boolean — Deprecated: use SourceID instead. Skip TLS verification when cloning the Git repository.

## Response `200`

Success

- StacksStackResponse
  - `AdditionalFiles` string[] — Only applies when deploying stack with multiple files
  - `AutoUpdate` PortainerAutoUpdateSettings
    - `ForcePullImage` boolean — Pull latest image
    - `ForceUpdate` boolean — Force update ignores repo changes
    - `Interval` string — Auto update interval Deprecated: polling interval now lives on the associated Source (Source.Interval). Kept for DB backwards-compatibility only; new code must not read or write this field.
    - `JobID` string — Autoupdate job id
    - `Webhook` string — A UUID generated from client
  - `CreatedBy` string — The username which created this stack
  - `CreationDate` integer — The date in unix time when stack was created
  - `CurrentDeploymentInfo` PortainerStackDeploymentInfo
    - `AdditionalFiles` string[] — AdditionalFiles are the additional files used for deploying the stack
    - `ConfigFilePath` string — ConfigFilePath is the path to the config file in the git repository used for deploying the stack
    - `ConfigHash` string — ConfigHash is the commit hash of the git repository used for deploying the stack
    - `FileVersion` integer — FileVersion is the version of the stack file, used to detect changes
    - `ReferenceName` string — ReferenceName is the git reference (branch/tag) used for deploying the stack
    - `RepositoryURL` string — RepositoryURL is the git repository URL used for deploying the stack
    - `SourceID` integer — SourceID is the Source used for deploying the stack
    - `Version` integer — Version is the version of the stack and also is the deployed version in edge agent
  - `DeploymentStartStatus` 0 | 1 | 2 | 3 | 4
  - `DeploymentStatus` PortainerStackDeploymentStatus[] — DeploymentStatus records the status progression of the current deployment. Cleared when a new deployment starts.
    - `Message` string — populated on Error entries
    - `Status` 0 | 1 | 2 | 3 | 4
    - `Time` integer
  - `EndpointId` integer — Environment(Endpoint) identifier. Reference the environment(endpoint) that will be used for deployment
  - `EntryPoint` string — EntryPoint is the path to the config file relative to the project root. NOTE: For git stacks this mirrors GitConfig.ConfigFilePath and the two are kept in sync by stackUpdateGit. The deploy command builder (compose_unpacker_cmd_builder) uses this field directly; Kubernetes deploy and git clone operations use GitConfig.ConfigFilePath.
  - `Env` PortainerPair[] — A list of environment(endpoint) variables used during stack deployment
    - `name` string, required
    - `value` string, required
  - `FromAppTemplate` boolean — Whether the stack is from a app template
  - `GitConfig` GittypesRepoConfig
    - `Authentication` GittypesGitAuthentication
      - `AuthorizationType` integer
      - `GitCredentialID` integer
      - `Password` string
      - `Provider` integer
      - `Username` string
    - `ConfigFilePath` string — ConfigFilePath is the path to the config file within the repository. NOTE: For stacks, this mirrors Stack.EntryPoint and the two are kept in sync by stackUpdateGit.
    - `ConfigHash` string — Repository hash
    - `ReferenceName` string — The reference name
    - `TLSSkipVerify` boolean — TLSSkipVerify skips SSL verification when cloning the Git repository
    - `URL` string — The repo url
  - `GitSourceId` integer
  - `Id` integer — Stack Identifier
  - `Name` string — Stack name
  - `Namespace` string — Kubernetes namespace if stack is a kube application
  - `Option` PortainerStackOption
    - `HelmAtomic` boolean — Enable atomic rollback on failure (Helm --atomic flag for Kubernetes Helm stacks)
    - `Prune` boolean — Prune services that are no longer referenced
  - `ProjectPath` string — Path on disk to the repository hosting the Stack file
  - `ResourceControl` PortainerResourceControl
    - `AccessLevel` 0 | 1
    - `AdministratorsOnly` boolean — Permit access to resource only to admins
    - `Id` integer — ResourceControl Identifier
    - `OwnerId` integer — Deprecated fields Deprecated in DBVersion == 2
    - `Public` boolean — Permit access to the associated resource to any user
    - `ResourceId` string — Docker resource identifier on which access control will be applied.\ In the case of a resource control applied to a stack, use the stack name as identifier
    - `SubResourceIds` string[] — List of Docker resources that will inherit this access control
    - `System` boolean
    - `TeamAccesses` PortainerTeamResourceAccess[]
      - `AccessLevel` 0 | 1
      - `TeamId` integer
    - `Type` 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
    - `UserAccesses` PortainerUserResourceAccess[]
      - `AccessLevel` 0 | 1
      - `UserId` integer
  - `Status` 0 | 1 | 2 | 3 | 4
  - `SwarmId` string — Cluster identifier of the Swarm cluster where the stack is deployed
  - `Type` 0 | 1 | 2 | 3
  - `UpdateDate` integer — The date in unix time when stack was last updated
  - `UpdatedBy` string — The username which last updated this stack
  - `WorkflowID` integer — WorkflowID is the ID of the Workflow that owns the Source for this stack.

## Other responses

- `400` — Invalid request
- `403` — Permission denied
- `404` — Not found
- `500` — Server error

---

[API](https://skmtc.net/portainer/apis/portainerce-api.md) · [All operations](https://skmtc.net/portainer/apis/portainerce-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/portainer/portainerce-api/versions/c0b0975cd11b/schema)
