Skip to content

Instantly share code, notes, and snippets.

@kevinbowen777
Last active May 5, 2022 19:38
Show Gist options
  • Save kevinbowen777/6c652a77111eb393721547582fb57ee7 to your computer and use it in GitHub Desktop.
Save kevinbowen777/6c652a77111eb393721547582fb57ee7 to your computer and use it in GitHub Desktop.
Git Quick Start

Creating git repositories on public source forges

Last updated: 20211215 20220223 20220505

Personal public repositories: GitHub - kevinbowen777 GitLab - kevinbowen

  1. Create local directory:

    mkdir $REPOSITORY_NAME && cd $_ (not needed when using gh)

  2. Create repository:

    a. Create repository from the cli (GitHub only):

    1. GitHub's cli tool with additional features https://cli.github.com - gh repo create

    b. Create repository via web interface (GitHub & GitLab):

    1. GitLab: - Menu -> Create new project -> Create blank project
    2. GitHub: - "Plus" Button -> New Repository - Intialize this repository with: - Leave all boxes unchecked - Click Create Repository button

    c. Add webhook for Discord notifications (GitHub only):

    1. Go to https://github.com/kevinbowen777/REPO_NAME/settings/hooks - Payload URL: <Add your webhook here> - Content Type:
      application/json - Accept the rest of the defaults Click Add Webhook button
  3. Initialize local repository (GitHub - use with web instructions & GitLab):

    git init --initial-branch=master
    git config --global user.name "Kevin Bowen"
    git config --global user.email "kevin.bowen@gmail.com"
    git remote add origin git@github.com:kevinbowen777/sampleproject.git
    # git remote add origin git@gitlab.com:kevinbowen/sampleproject.git
    # git remote remove origin
  1. Copy initial files into repo from last project (or ~/dotfiles/git if available):
    cp ../djangdo/.gitignore .
    cp ../djangdo/LICENSE .
    cp ../djangdo/README.md .
    # black & isort configurations
    cp ../djangdo/.pre-commit-config.yaml .
    # project details & flake8 configuration (Be sure to update project information)
    cp ../djangdo/setup.cfg
    # black & isort configuration. Remove any other info from poetry/previous project
    cp ../djangdo/pyproject.toml .
  1. Initial commit:
    git add .
    git commit -m "initial commit"
    git push origin master
  1. Create virtualenv: mkvirtualenv $REPO_NAME

  2. Initialize poetry:

    poetry init
    poetry add -D black
    poetry add -D flake8
    poetry add -D isort
    poetry add -D pre-commit
  1. Initialize pre-commit: pre-commit install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment