Giter Site home page Giter Site logo

fastrepo's Introduction

fastrepo.py

FastRepo is a Python script that automates the creation of a new GitHub repository and commits the current directory's contents to it, including the setup of a .gitignore and a LICENSE file without user intervention.

Features

  • Creates a new GitHub repository with the current directory's name.
  • Adds all files in the current directory to the new repository, excluding specified files in .gitignore.
  • Automatically generates a .gitignore file that excludes patterns such as *.csv, *.xlsx, environment files, and more, ensuring sensitive or unnecessary files are not committed.
  • Includes a LICENSE file with a predefined MIT license in the repository.
  • Commits the files to the repository.
  • Configurable to use either HTTPS or SSH.

Usage

To use FastRepo, run the script in the directory you want to upload:

python fastrepo.py

Preparations

Before running fastrepo.py, ensure:

  • A GitHub Personal Access Token (PAT) is obtained and set in your environment as GITHUB_REPO_TOKEN.
  • You have decided whether to include .csv and .xlsx files in your project. By default, these files are ignored to prevent accidental upload of potentially sensitive data.

Obtaining a GitHub Personal Access Token

A GitHub Personal Access Token (PAT) is required to authenticate with the GitHub API and access private repositories. Follow these steps to generate a token:

  1. Log in to your GitHub account and navigate to the Settings page by clicking on your profile picture in the top-right corner and selecting Settings.
  2. In the left sidebar, click on Developer settings.
  3. Click on Personal access tokens in the left sidebar.
  4. Click the Generate new token button.
  5. Enter a name for the token in the Note field (e.g., "Repo-Prep").
  6. Select the appropriate scopes for the token. For the fastrepo.py script, the minimum required scope is repo (which grants full control of private repositories). You may need to select additional scopes depending on your use case.
  7. Click the Generate token button at the bottom of the page.

In the fastrepo.py script, replace the GITHUB_REPO_TOKEN placeholder with your actual token or add it to the GITHUB_REPO_TOKEN environment variable as detailed to automatically pull it from your environment.

  • Add GitHub Personal Access Token to environment variable GITHUB_REPO_TOKEN
    • Windows:

      setx GITHUB_REPO_TOKEN "YourGitHubToken"
    • Linux:

      echo 'export GITHUB_REPO_TOKEN="YourGitHubToken"' >> ~/.bashrc
      source ~/.bashrc

This ensures that your script can authenticate with GitHub to create the repository and push the initial commit.

fastrepo's People

Contributors

jimmc414 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.