Skip to content

Create from template does not reference the right branch. #21994

Closed
@saul-jb

Description

@saul-jb

Description

If you create a template with a different default branch (e.g. not 'main') and create another repository from that template, it sets the default branch to an empty reference to 'main' causing this error when cloning it warning: remote HEAD refers to nonexistent ref, unable to checkout.. This can be resolved by changing the default branch to the one from the template but that should be the default behavior or at least it should provide an option to specify the name of the branch.

To reproduce:

  1. Create a template repository with the default branch as anything but 'main'.
  2. Create a repository from that template including the git content of the template.
  3. Check to see if the default branch points to an invalid ref.

Gitea Version

1.18.0

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Problem exists on both https://try.gitea.io/ and docker.

Database

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions