# Upload to Galaxy from custom Git server? (not github.com)

**URL:** <https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319>\
**Category:** Get Help\
**Tags:** galaxy-ng\
**Created:** [February 11, 2026, 10:42am UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319 "2026-02-11T10:42:18Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![piffpaff](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@piffpaff](https://forum.ansible.com/u/piffpaff)\
**Post date:** [February 11, 2026, 10:42am UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/1 "2026-02-11T10:42:18Z")

</div>

I moved my Ansible roles from GitHub to a self-hosted GitLab instance. Is there a way to specify a custom Git server when doing `ansible-galaxy role import`?

It seems I cannot update my roles on [https://galaxy.ansible.com](https://galaxy.ansible.com) anymore without a GitHub repository.

The import command only seems to support GitHub usernames and repositories:

```auto
ansible-galaxy role import --help
usage: ansible-galaxy role import [-h] [-s API_SERVER] [--token API_KEY] [-c] [--timeout TIMEOUT] [-v] [--no-wait] [--branch REFERENCE] [--role-name ROLE_NAME] [--status] github_user github_repo

positional arguments:
  github_user GitHub username
  github_repo GitHub repository

```

with no way to specify a custom repository url/path.

I couldn’t find a related forum thread. Is there a way to update the existing roles in Galaxy?

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 11, 2026, 12:54pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/2 "2026-02-11T12:54:22Z")

</div>

I do this using a `requirements.yml` files like this:

```yaml
- name: apt
  scm: git
  src: https://git.coop/webarch/apt.git
  version: 4.12.1 # apt

```

I even wrote a role to generate it!

> **[webarch / requirements · GitLab](https://git.coop/webarch/requirements#webarchitects-ansible-requirements-role)**
>
> An Ansible role to create and update Ansible requirements.yml files.

You can use the `requirements.yml` file like this:

```bash
ansible-galaxy install -r requirements.yml --force

```

---

<div class="post-metadata">

**Author:** ![piffpaff](https://avatars.discourse-cdn.com/v4/letter/p/bbe5ce/32.png) [@piffpaff](https://forum.ansible.com/u/piffpaff)\
**Post date:** [February 11, 2026, 1:17pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/3 "2026-02-11T13:17:06Z")

</div>

Thank you for your input, but I’m looking for a way to keep up-to-date what is uploaded to Ansible Galaxy, meaning as a publisher of a role, not a user.  
I updated the thread topic to reflect this better.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 11, 2026, 1:55pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/4 "2026-02-11T13:55:21Z")

</div>

Ah, sorry for misunderstanding, the way I plan to do this is to push mirror all role repos from GitLab to GitHub, so far I only do this for some:

> **[Push repo mirroring to GitHub ($88) · Snippets · GitLab](https://git.coop/-/snippets/88)**
>
> Git hosting for Co-operators

And then setup GitHub actions to push to Galaxy, this part I haven’t got around to doing but I do recall seeing threads here that explain how to do this.

---

<div class="post-metadata">

**Author:** ![shertel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/shertel/32/1241_2.png) [@shertel](https://forum.ansible.com/u/shertel)\
**Post date:** [February 11, 2026, 2:20pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/5 "2026-02-11T14:20:13Z")

</div>

It’s not possible to upload to Galaxy from a custom Git server. Galaxy does not import the role itself, just metadata about the location and versions, and it constructs the download URL like this [galaxy\_ng/galaxy\_ng/app/api/v1/serializers.py at main · ansible/galaxy\_ng · GitHub](https://github.com/ansible/galaxy_ng/blob/main/galaxy_ng/app/api/v1/serializers.py#L474).

---

<div class="post-metadata">

**Author:** ![kks](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/kks/32/10352_2.png) [@kks](https://forum.ansible.com/u/kks)\
**Post date:** [February 11, 2026, 5:01pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/6 "2026-02-11T17:01:32Z")

</div>

Collections can be published from any server for that only ansible-galaxy command is required. This command is installed with ansible-core

ansible-galaxy collection publish “${COLLECTION\_BUILD\_FILENAME}” --server “${API\_SERVER\_ALIAS}”

You have to have ansible.cfg file with server configuration or pass additional parameters to that command. See help for ansible-galaxy command.

Never worked with standalone roles. Probably something similar.

---

<div class="post-metadata">

**Author:** ![chris](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/chris/32/293_2.png) [@chris](https://forum.ansible.com/u/chris)\
**Post date:** [February 11, 2026, 5:06pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/7 "2026-02-11T17:06:47Z")

</div>

> [@kks](#):
>
> Probably something similar.

There is no `publish` option for roles, only `import`:

```bash
ansible-galaxy role --help
usage: ansible-galaxy role [-h] ROLE_ACTION ...

positional arguments:
  ROLE_ACTION
    init Initialize new role with the base structure of a role.
    remove Delete roles from roles_path.
    delete Removes the role from Galaxy. It does not remove or alter the actual GitHub repository.
    list Show the name and version of each role installed in the roles_path.
    search Search the Galaxy database by tags, platforms, author and multiple keywords.
    import Import a role into a galaxy server
    setup Manage the integration between Galaxy and the given source.
    info View more details about a specific role.
    install Install role(s) from file(s), URL(s) or Ansible Galaxy

options:
  -h, --help show this help message and exit

ansible-galaxy role import --help
usage: ansible-galaxy role import [-h] [-s API_SERVER] [--token API_KEY] [-c] [--timeout TIMEOUT] [-v]
                                  [--no-wait] [--branch REFERENCE] [--role-name ROLE_NAME] [--status]
                                  github_user github_repo

positional arguments:
  github_user GitHub username
  github_repo GitHub repository

options:
  -h, --help show this help message and exit
  -s, --server API_SERVER
                        The Galaxy API server URL
  --token, --api-key API_KEY
                        The Ansible Galaxy API key which can be found at
                        https://galaxy.ansible.com/me/preferences.
  -c, --ignore-certs Ignore SSL certificate validation errors.
  --timeout TIMEOUT The time to wait for operations against the galaxy server, defaults to 60s.
  -v, --verbose Causes Ansible to print more debug messages. Adding multiple -v will increase
                        the verbosity, the builtin plugins currently evaluate up to -vvvvvv. A
                        reasonable level to start is -vvv, connection debugging might require -vvvv.
                        This argument may be specified multiple times.
  --no-wait Don't wait for import results.
  --branch REFERENCE The name of a branch to import. Defaults to the repository's default branch
                        (usually master)
  --role-name ROLE_NAME
                        The name the role should have, if different than the repo name
  --status Check the status of the most recent import request for given
                        github_user/github_repo.

```

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [February 11, 2026, 5:16pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/8 "2026-02-11T17:16:28Z")

</div>

As @shertel wrote you cannot import roles into Galaxy from anywhere except from GitHub. That was a design decision made a long time ago for roles (basically when Galaxy was created), and very likely won’t change.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 13, 2026, 5:16pm UTC](https://forum.ansible.com/t/upload-to-galaxy-from-custom-git-server-not-github-com/45319/9 "2026-03-13T17:16:49Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
