Forking the nRF Connect SDK repositoriesΒΆ

If you want to change any of the code that is provided by the nRF Connect SDK and contribute this updated code back to the nRF Connect SDK, you should create your own forks of the nRF Connect SDK repositories.

To fork the repositories and update your cloned repositories to use your fork, complete the following steps:

  1. Fork the four nRF Connect SDK repositories to your own GitHub account by clicking the Fork button in the upper right-hand corner of each repository page:

  2. Open a Git bash or terminal window in the ncs folder.

  3. For each of the four repository folders, complete the following steps, replacing Folder with the respective folder name (nrf, zephyr, mcuboot, or nrfxlib):

    1. Enter the respective folder:

      cd Folder
    2. For nrf, rename the default remote that points to the upstream nRF Connect SDK repository from origin to ncs:

      git remote rename origin ncs

      You do not need to do this for the other repositories, because their default remotes are already named ncs.

    3. Add the fork that you created as default remote with the name origin. To do so, enter one of the following commands, replacing Username with your GitHub user name:

      For nrf:
      git remote add origin
      For zephyr:
      git remote add origin
      For mcuboot:
      git remote add origin
      For nrfxlib:
      git remote add origin
    4. Optionally, for zephyr and mcuboot, add remotes for the upstream repositories:

      For zephyr:
      git remote add upstream
      For mcuboot:
      git remote add upstream
    5. Verify the remote repositories by entering the following command:

      git remote -v

      The output should look similar to this example for zephyr:

      ncs (fetch)
      ncs (push)
      origin (fetch)
      origin (push)
      upstream (fetch)
      upstream (push)
    6. Go back to the ncs folder:

      cd ..

You can now work on your local fork (origin), but also fetch and check out branches from ncs and upstream.