How to add my current project to an already existing GitHub repository

后端 未结 6 1031
南笙
南笙 2021-01-29 23:01

I\'m very new to Git. I\'ve been searching for an answer, but I couldn\'t find one.

In my computer I have a project folder like this:

project_a
--some_fo         


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-01-29 23:22

    Assume that I would like to add FreeRTOS repository, which URL is https://github.com/FreeRTOS/FreeRTOS-Kernel.git, into my repository, example URL is https://github.com/username/example as a submodule

    git submodule add https://github.com/FreeRTOS/FreeRTOS-Kernel.git
    git add .
    git commit -m 'add a submodule'
    git push
    

    To clone using HTTPS:

    git clone https://github.com/username/example.git --recurse-submodules
    

    Using SSH:

    git clone git@github.com:username/example.git --recurse-submodules
    

    If you have downloaded the repo without using the --recurse-submodules argument, you need to run:

    git submodule update --init --recursive
    

提交回复
热议问题