Skip to content

Error fetching changes from Github #63

@antoineleclair

Description

@antoineleclair

While running a deployment, the deployment output showed this:

Deployment 1225 enqueued
Starting deployment
Fetching from github.com/orgname/reponame
Failed to fetch repository. Is the repository accessible?
Deployment failed
Restoring previous deployment

The logs showed this:

INFO:disco.utils.github:Output: error: cannot lock ref 'refs/remotes/origin/branch-name/dev': 'refs/remotes/origin/branch-name' exists; cannot create 'refs/remotes/origin/branch-name/dev'
INFO:disco.utils.github:Output: From https://github.com/orgname/reponame
INFO:disco.utils.github:Output:  ! [new branch]            branch-name/dev -> origin/branch-name/dev  (unable to update local ref)
INFO:disco.utils.github:Output: error: some local refs could not be updated; try running
INFO:disco.utils.github:Output:  'git remote prune origin' to remove any old, conflicting branches
INFO:disco.utils.deployments:Setting deployment status of deployment DEPLOYMENT_0ca8830bcc43458084a36acc01e723ac (dev 1223) to FAILED
 INFO:disco.utils.events:Dispatching event deployment:status: {"id": "2025-10-06T15:43:52.466302+00:00", "timestamp": "2025-10-06T15:43:52.466302+00:00", "type": "deployment:status", "data": {"project": {"name": "dev"}, "deployment": {"number": 1223, "status": "FAILED"}}}
ERROR:disco.utils.deploymentflow:Exception while deploying
Traceback (most recent call last):
  File "/disco/app/disco/utils/deploymentflow.py", line 235, in process_deployment
    await prepare_deployment(
  File "/disco/app/disco/utils/deploymentflow.py", line 315, in prepare_deployment
    await checkout_commit(new_deployment_info, log_output)
  File "/disco/app/disco/utils/deploymentflow.py", line 572, in checkout_commit
    await github.fetch(
  File "/disco/app/disco/utils/github.py", line 204, in fetch
    raise GithubException(f"Git returned status {process.returncode}")
disco.utils.github.GithubException: Git returned status 1

From this

args = ["git", "fetch", "origin"]
process = await asyncio.create_subprocess_exec(
*args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
cwd=project_path(project_name),
)
assert process.stdout is not None
async for line in process.stdout:
line_text = decode_text(line)
if line_text.endswith("\n"):
line_text = line_text[:-1]
log.info("Output: %s", line_text)
await process.wait()
if process.returncode != 0:
raise GithubException(f"Git returned status {process.returncode}")

(running git fetch origin)

I tried running it on the machine, using SSH and got this:

root@machine-name:~/disco/projects/project-name# git fetch origin
error: cannot lock ref 'refs/remotes/origin/branch-name/project-name': 'refs/remotes/origin/branch-name' exists; cannot create 'refs/remotes/origin/branch-name/project-name'
From https://github.com/orgname/reponame
 ! [new branch]            branch-name/project-name -> origin/branch-name/project-name  (unable to update local ref)
error: some local refs could not be updated; try running
 'git remote prune origin' to remove any old, conflicting branches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions