https://github.com/babupriyavrat/git_auto
https://github.com/babupriyavrat/git_auto
beginner-friendly easy git push relax
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/babupriyavrat/git_auto
- Owner: babupriyavrat
- Created: 2024-11-24T11:49:09.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-31T11:19:38.000Z (over 1 year ago)
- Last Synced: 2025-02-03T23:37:05.494Z (over 1 year ago)
- Topics: beginner-friendly, easy, git, push, relax
- Language: Shell
- Homepage: https://babupriyavrat.com
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Here's the complete `README.md` file with all the instructions and details:
# Repository Initialization Script
This script automates the process of initializing a Git repository, creating a `.gitignore` file from a template, adding files to the repository, and pushing them to a remote GitHub repository. It also handles large files using Git LFS and allows users to skip specific folders during the `git add` process.
## Functionalities
1. **Initialize Git Repository**: Initializes a new Git repository if it doesn't already exist.
2. **Create `.gitignore` File**: Creates a `.gitignore` file from a `.gitignore_template` file located in the current directory.
3. **Skip Specified Folders**: Allows users to skip specific folders during the `git add` process.
4. **Handle Large Files**: Checks for files larger than 100 MB and prompts the user to use Git LFS to track them.
5. **Branch Management**: Handles branch creation and switching based on user input.
6. **Push to Remote Repository**: Pushes the committed files to a remote GitHub repository.
## Scenarios
1. **New Repository**: The script creates a new private repository on GitHub if it doesn't already exist.
2. **Existing Repository**: The script pulls the latest changes from the remote repository if it already exists.
3. **Large Files**: The script prompts the user to use Git LFS for files larger than 100 MB.
4. **Skipping Folders**: The script allows users to skip specific folders during the `git add` process.
## Installation Instructions
1. **Clone the Repository**: Clone the repository containing the script to your local machine.
```bash
git clone https://github.com/yourusername/yourrepository.git
```
2. **Navigate to the Script Directory**: Change to the directory containing the script.
```bash
cd yourrepository
3.**Add environment variable**
You can create the PAT KEY from Github account > Settings > DeveLoper Settings > Personal Access Tokens.
Take the Personal Access tokens and store in environment variable GIT_PAT_KEY.IF you Personal Access Tokens expire, you have to reset the environment variable.
4. **Ensure `.gitignore_template` Exists**: Make sure there is a `.gitignore_template` file in the current directory. This file should contain the patterns for files and folders to be ignored by Git.
5. **Run the Script**: Execute the script.
```bash
./git_init.sh # for simple features (1,2 and 6)
./git_comprehensive_init.sh # for all features
```
## Usage Instructions
1. **Enter the Full Path of the Repository**: When prompted, enter the full path of the repository you want to initialize.
```bash
Enter the full path of the repository: /path/to/your/repository
```
2. **Select Folders to Skip**: The script will list the folders and their sizes. Enter the numbers of the folders you want to skip, separated by commas.
```bash
Enter the numbers of folders to skip (comma-separated): 0,2,4
```
3. **Enter Branch Name**: Enter the name of the branch you want to create or switch to.
```bash
Enter the branch name: main
```
4. **Enter Commit Message**: Enter the commit message for the changes.
```bash
Enter the commit message: "Initial commit"
```
5. **Handle Large Files**: If the script encounters a file larger than 100 MB, it will prompt you to use Git LFS to track the file.
```bash
/path/to/large/file is larger than 100 MB. Do you want to use Git LFS to track this file? (y/n): y
```
6. **Push to Remote Repository**: The script will push the committed files to the remote GitHub repository.
## Requirements
- Git
- Git LFS (for handling large files)
## Notes
- Ensure you have the necessary permissions to create repositories on GitHub.
- Make sure your GitHub personal access token (PAT) has the required scopes (e.g., `repo`) to create and push to repositories.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
```
Feel free to customize the `README.md` file as needed. Let me know if you need any further assistance!