-
Notifications
You must be signed in to change notification settings - Fork 0
Step 5: Create a local repository for our subdirectory
Elias Ranz-Schleifer edited this page Jan 23, 2020
·
1 revision
Now that we have a Github repository we can create a local repository that we'll configure to use the new repository we created as a remote.
You'll see some git remote commands below, which will be the ones that Github provided you on submodule repository that you created.
Note: We're using pushd and popd, if these commands aren't found then you should be able to replace them with cd and cd .. respectively. pushd will allow you to change directory while retaining the origin location of where you ran it from. When you run popd you'll be returned to that same location. In the following example you'll see the paths represented in the output.
$ pushd foo
~/git/submodule-poc/foo ~/git/submodule-poc # <target directory> <source directory>
$ git init
Initialized empty Git repository in ~/git/submodule-poc/foo/.git/
$ git remote add origin git@github.com:EliasRanz/submodule-poc-submodule.git
$ git remote -v
origin git@github.com:EliasRanz/submodule-poc-submodule.git (fetch)
origin git@github.com:EliasRanz/submodule-poc-submodule.git (push)