---
schema_version: "1"
id: c1f7864da01df44e3471b394a299be003f35c51410b140f4580ccdb90765e6d8
title: Link a Namespace to a Dev Hub Org
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform-pkg-exchange/managed_packaging/guides/sfdx-dev/workspace-setup/sfdx-dev-reg-namespace.md
canonical_url: https://developer.salesforce.com/docs/platform/pkg2-dev/guide/sfdx-dev-reg-namespace.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f5b9f470acc0b30e7b9efa72ba50729032ab8be7175b03fb6a920e0f7a79b709
products:
  - Second-Generation Managed Packaging Developer Guide
  - merged-docs
---

# Link a Namespace to a Dev Hub Org

To use a namespace with a scratch org, you must link the Developer Edition org where the namespace is registered to a Dev Hub org.

## Before You Begin

Complete these tasks before you link a namespace.

- If you don’t have an org with a registered namespace, create a Developer Edition org that is separate from the Dev Hub or scratch orgs. If you already have an org with a registered namespace, you’re good to go.
- In the Developer Edition org, create and register the namespace.

  **important:** Choose namespaces carefully. If you’re trying out this feature or need a namespace for testing purposes, choose a disposable namespace. Don’t choose a namespace that you want to use in the future for a production org or some other real use case. After you associate a namespace with an org, you can't change it or reuse it.

1.  Log in to your Dev Hub org as the System Administrator or as a user with the Salesforce DX Namespace Registry permissions.

    **tip:** Make sure your browser allows pop-ups from your Dev Hub org.

    1.  From the App Launcher menu, select **Namespace Registries**.

    2.  Click **Link Namespace**.

2.  In the window that pops up, log in to the Developer Edition org in which your namespace is registered using the org's System Administrator's credentials.

    You can’t link orgs without a namespace: sandboxes, scratch orgs, patch orgs, and branch orgs require a namespace to be linked to the Namespace Registry.

## Next Steps

To view all the namespaces linked to the Namespace Registry, select the **All Namespace Registries** list view.
