Skip to content

Connect to remote repository on GitHub

Initialize local repository

Now lets initialize a git repository within the created project for version control.
First, move into the directory of the project.

$ cd project-name/

Then, setup poetry dependency manager,

$ pip install poetry && poetry install

For more info on poetry, check out their docs.

Lastly, initialize the repo.

$ git init

This will create a git repository within the project. Don't do anything just yet with it.

Create remote repository on GitHub

If it hasn't already been created, we'll have to create a remote repository on GitHub. To do so, follow the steps:

  1. Go to GitHub's create new repository page.
  2. Fill in the name and description with the values given at project creation.
  3. Make your choice of Public or Private.
  4. Leave all other boxes unchecked.

Sync local repository with GitHub

Let's start with adding the newly created remote repository to the local repostiory so it knows where to push changes to. To do so run:

$ git remote add origin link_to_repo

Make sure to replace link_to_repo with your repo's url. It can be found on your repository's home page under the green "Code" dropdown menu button.

Push local files to remote

Now that the remote repository is setup let's get all the code generated by the cookiecutter there.

First let's add all the project files to the local repository (remember we only initalized an empty repository):

$ git add .

Next, commit those changes:

$ git commit -m "Initialize repo"

Then, we name the current branch (with the files) to main:

$ git branch -M main

Note if main is not used. You must change the branch reference in certain files within the '.github/workflows' directory for CI checks to work.

Finally, lets push it to GitHub:

$ git push -u origin main

That's it! Now you should see your GitHub repository with all the starter files.

In addition, check out the "Actions" section of the repository to see the CI checks (docs deployment and code quality) being run. Once these are done, you'll see a gh-pages branch was created with odd files. Don't worry about that for now, it's the automatically generated documenation and we'll cover how to have that hosted on your own webpage in the next section.

Continue on to see how to configure your GitHub repository to work optimally with the cookiecutter setup!