Skip to content

Instantly share code, notes, and snippets.

@kalilinux-png
Last active September 9, 2024 12:50
Show Gist options
  • Save kalilinux-png/3817ae3996accaef37b3c3287f4be1ff to your computer and use it in GitHub Desktop.
Save kalilinux-png/3817ae3996accaef37b3c3287f4be1ff to your computer and use it in GitHub Desktop.
This is a script for automating the creation of a GitHub repository.
#!/bin/bash
# ------------------------------------------------------------------
# Script to initialize a new project with essential files and GitHub setup.
# Author: Shubham Yadav
# Date: Keep's On Changing
# Description: This script sets up a new project repository with necessary files and GitHub integration.
# ------------------------------------------------------------------
echo "Welcome to the project initialization script!"
# Get the current directory name
REPO_NAME=$(basename "$PWD")
echo "Setting up project: $REPO_NAME"
# Create a .gitignore file with essential exclusions
echo "Creating .gitignore file..."
cat << EOF > .gitignore
# Node.js
node_modules/
# Python
__pycache__/
*.py[cod]
*.pyd
*.pyo
*.pyz
*.pyc
# React / build
build/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Coverage directories
coverage
.nyc_output
# Build output directories
build/
.next
.nuxt
.vuepress/dist
.serverless/
.fusebox/
.dynamodb/
# TypeScript
typings/
# Yarn
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.yarn/releases
# IDE / editors
.idea/
.vscode/
*.swp
*.swo
*.swn
*.bak
# Environment variables
.env
.env.test
# Miscellaneous
*.tgz
.tern-port
.vscode-test
EOF
# Get the current date
START_DATE=$(date)
# Create a README.md file with project details
echo "Creating README.md file..."
cat << EOF > README.md
# Project Name: $REPO_NAME
## Start Date
$START_DATE
## Description
Welcome to the $REPO_NAME project! Started on $START_DATE. This project is designed to [Brief Project Description].
## Installation
1. Clone the repository: \`git clone [REPOSITORY_URL]\`
2. Navigate into the directory: \`cd $REPO_NAME\`
3. Install dependencies: \`npm install\`
## Usage
To start the project, use: \`npm start\`
## Contributing
We welcome contributions! To contribute:
1. Fork the repository
2. Create a new branch for your feature or fix
3. Submit a pull request
## License
This project is licensed under the MIT License.
EOF
# Initialize a new Git repository
echo "Initializing Git repository..."
git init
# Add all files to the repository and commit them
echo "Adding files to Git repository and making initial commit..."
git add .
git commit -m "Initial commit - Project setup with .gitignore and README.md"
# Create a new GitHub repository
echo "Creating GitHub repository on GitHub..."
gh repo create "$REPO_NAME" --private --source=. --remote=origin --push --add-readme
# Push the committed files to the new GitHub repository
echo "Pushing initial commit to GitHub repository..."
git push -u origin main
# Final motivational message
echo "πŸŽ‰ Project $REPO_NAME has been successfully set up! πŸŽ‰"
echo "You're on your way to building something amazing. Keep pushing forward and make an impact with your code!"
@kalilinux-png
Copy link
Author

kalilinux-png commented Jun 2, 2024

Use the following command to download and execute directly:
curl https://gist.githubusercontent.com/kalilinux-png/3817ae3996accaef37b3c3287f4be1ff/raw/2919ae60a800a097834e667e005c618c0a116d1b/gitAutomation.sh | bash

@kalilinux-png
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment