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:

    1. https://github.com/NordicPlayground/fw-nrfconnect-nrf
    2. https://github.com/NordicPlayground/fw-nrfconnect-zephyr
    3. https://github.com/NordicPlayground/fw-nrfconnect-mcuboot
    4. https://github.com/NordicPlayground/nrfxlib
  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 https://github.com/Username/fw-nrfconnect-nrf.git
      
      For zephyr:
      git remote add origin https://github.com/Username/fw-nrfconnect-zephyr.git
      
      For mcuboot:
      git remote add origin https://github.com/Username/fw-nrfconnect-mcuboot.git
      
      For nrfxlib:
      git remote add origin https://github.com/Username/nrfxlib.git
      
    4. Optionally, for zephyr and mcuboot, add remotes for the upstream repositories:

      For zephyr:
      git remote add upstream https://github.com/zephyrproject-rtos/zephyr.git
      
      For mcuboot:
      git remote add upstream https://github.com/JuulLabs-OSS/mcuboot.git
      
    5. Verify the remote repositories by entering the following command:

      git remote -v
      

      The output should look similar to this example for zephyr:

      ncs     https://github.com/NordicPlayground/fw-nrfconnect-zephyr (fetch)
      ncs     https://github.com/NordicPlayground/fw-nrfconnect-zephyr (push)
      origin   https://github.com/Username/fw-nrfconnect-zephyr (fetch)
      origin   https://github.com/Username/fw-nrfconnect-zephyr (push)
      upstream https://github.com/zephyrproject-rtos/zephyr (fetch)
      upstream https://github.com/zephyrproject-rtos/zephyr (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.