Git-Captain is a powerful web application that simplifies managing multiple GitHub repositories simultaneously. Originally created to solve the pain of creating same-named branches across numerous repositories for GitFlow and TeamCity workflows, it has evolved into a comprehensive repository management tool.
Perfect for teams working with microservices, multi-repo projects, or any scenario requiring coordinated repository operations.
- ๐ฟ Branch Management: Create, search, and delete branches across multiple repositories
- ๐ Pull Request Discovery: Find open pull requests by base branch
- ๐ Secure GitHub OAuth: Seamless authentication with GitHub
- ๐ก๏ธ Enterprise Security: Rate limiting, CORS, input validation, security headers
- ๐ Real-time Results: Live feedback with detailed operation logs
- ๐ฏ Batch Operations: Select multiple repositories for simultaneous operations
- ๐ฑ Modern UI: Clean, responsive interface with loading states
- Node.js 18+
- GitHub account with repository access
- SSL certificates (for HTTPS)
-
Clone the repository
git clone https://github.com/ConfusedDeer/Git-Captain.git cd Git-Captain -
Install dependencies
npm install
-
Configure environment (see Configuration)
-
Generate SSL certificates (see SSL Setup)
-
Start the server
npm start
-
Access the application
https://localhost:3000
Create a .env file in the controllers directory:
# GitHub OAuth Configuration
client_id=your_github_client_id
client_secret=your_github_client_secret
GITHUB_ORG_NAME=your_organization_name
# Server Configuration
PORT=3000
GIT_PORT_ENDPOINT=https://your-domain.com
# SSL Certificate Paths
privateKeyPath=./theKey.key
certificatePath=./theCert.cert-
Create OAuth App in GitHub:
- Go to GitHub Settings โ Developer settings โ OAuth Apps
- Click "New OAuth App"
- Application name: Git-Captain
- Homepage URL:
https://your-domain.com - Authorization callback URL:
https://your-domain.com/authenticated.html
-
Copy credentials to your
.envfile
Generate self-signed certificates (for development):
# Install OpenSSL
# Windows: Download from https://slproweb.com/products/Win32OpenSSL.html
# Linux: sudo apt install openssl
# Generate certificates
openssl req -nodes -new -x509 -keyout controllers/theKey.key -out controllers/theCert.cert
# Set proper permissions (Linux/Mac)
chmod 600 controllers/theKey.key controllers/theCert.certFor production, use Let's Encrypt or purchase a CA-signed certificate.
Git-Captain implements enterprise-grade security measures:
- ๐ก๏ธ Security Headers: Helmet.js with CSP, HSTS, and security headers
- ๐ฆ Rate Limiting:
- General: 200 requests/minute
- Auth operations: 300 requests/5 minutes
- Sensitive operations: 25 requests/5 minutes
- ๐ CORS Protection: Configurable cross-origin policies
- โ Input Validation: express-validator for all API endpoints
- ๐ Security Logging: Comprehensive audit trails
- ๐ Session Management: Secure session handling with timeouts
| Endpoint | Method | Description |
|---|---|---|
/gitCaptain/getToken |
GET/POST | OAuth token exchange |
/gitCaptain/searchForRepos |
POST | Search for all your organizations' repositories |
/gitCaptain/createBranches |
POST | Create a branch with the same name across all your repositories. Example: creating 'feature/newAwesomeBranch' will create this branch in all repos. |
/gitCaptain/searchForBranch |
POST | Searching for a specific branch across ALL your repos. Example: Searching for a branch named 'feature/newAwesomeBranch' will search for this branch and display in which repos that branch exists |
/gitCaptain/searchForPR |
POST | Find pull requests |
/gitCaptain/deleteBranches |
DELETE | Delete a branch with the same name across all your repositories. Example: deleting 'feature/newAwesomeBranch' will remove this branch from all repos where it exists. |
/gitCaptain/checkGitHubStatus |
GET | GitHub API status |
Git-Captain v2.0 features a modern, secure architecture built on Node.js and Express:
graph TB
User[๐ค User] --> Browser[๐ Browser]
Browser -->|HTTPS| Proxy[๐ Reverse Proxy]
Proxy --> App[๐ Git-Captain App<br/>Node.js + Express]
App --> Security[๐ก๏ธ Security Layer<br/>Helmet + CORS + Rate Limiting]
App --> Auth[๐ GitHub OAuth<br/>Authentication]
App --> API[๐ GitHub API<br/>Repository Operations]
App --> Logs[๐ Winston Logging]
App --> Static[๐ Static Assets]
classDef user fill:#e1f5fe
classDef app fill:#e8f5e8
classDef security fill:#fff3e0
classDef external fill:#fce4ec
class User,Browser user
class Proxy,App app
class Security,Auth security
class API,Logs,Static external
Key Components:
- Security-First Design: Multiple layers of protection including rate limiting, input validation, and security headers
- OAuth Integration: Seamless GitHub authentication with secure token handling
- Modern HTTP Client: Axios-based client replacing deprecated request library
- Comprehensive Logging: Winston-powered structured logging with rotation
- Production Ready: Designed for scalability with PM2 process management
๐ Detailed Documentation:
- System Architecture - Complete architecture with interactive Mermaid diagrams
- Architecture Tools - Guide to various diagramming tools for GitHub
- Deployment Guide - Production deployment instructions
- Security Overview - Security features and best practices
npm start # Start production server
npm run dev # Start development server (if configured)
npm test # Run tests
npm run lint # Code linting
npm audit # Security auditGit-Captain/
โโโ controllers/ # Backend logic
โ โโโ server.js # Main server file
โ โโโ config.js # Configuration management
โ โโโ middleware.js # Security middleware
โ โโโ validation.js # Input validation schemas
โ โโโ httpClient.js # HTTP client (Axios wrapper)
โ โโโ logger.js # Winston logging setup
โ โโโ .env # Environment variables
โโโ public/ # Frontend assets
โ โโโ js/ # JavaScript files
โ โโโ css/ # Stylesheets
โ โโโ images/ # Images and icons
โ โโโ views/ # HTML templates
โโโ docs/ # Documentation
โโโ logs/ # Application logs
โโโ scripts/ # Utility scripts
npm install
# Configure .env file
npm startUse nginx or Apache to handle SSL and forward to port 3000:
server {
listen 443 ssl;
server_name yourdomain.com;
ssl_certificate /path/to/cert.pem;
ssl_certificate_key /path/to/key.pem;
location / {
proxy_pass https://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]- AWS: ECS + ALB or Elastic Beanstalk
- Azure: App Service or Container Instances
- Google Cloud: Cloud Run or Compute Engine
- Heroku: Direct deployment with buildpacks
Basic firewall setup for production:
# Linux (UFW)
sudo ufw allow 3000
sudo ufw allow 443
# Windows
netsh advfirewall firewall add rule name="Git-Captain" dir=in action=allow protocol=TCP localport=3000For detailed enterprise deployment, see docs/DEPLOYMENT.md
- โ
Removed deprecated
requestlibrary โ Modern Axios HTTP client - โ Added comprehensive security middleware (Helmet, CORS, Rate limiting)
- โ Implemented input validation for all API endpoints
- โ Modern async/await patterns throughout codebase
- โ Environment-based configuration (.env files)
- โ Structured logging system with Winston
- โ Fixed API response formatting for consistent client-server communication
- โ Updated all dependencies to latest secure versions
- โ Eliminated security vulnerabilities (npm audit clean)
- โ Branch search results now display correctly in UI
- โ Pull request search functionality restored
- โ OAuth flow improvements with proper error handling
- โ Rate limiting optimized for development and production
- โ GitHub API URL corrections for branch operations
- โ Complete README overhaul (this document)
- โ Enterprise deployment guide (docs/DEPLOYMENT.md)
- โ Technical change documentation (MODULE_UPDATES.md)
- โ Architecture documentation with rich diagrams (docs/ARCHITECTURE.md)
- โ Mermaid diagram collection (docs/ARCHITECTURE_MERMAID.md)
All documentation now includes rich Mermaid diagrams that render beautifully in both VS Code and GitHub:
- ๐๏ธ System Architecture: High-level component overview
- ๐ Request Flow: OAuth and API call sequences
- โก Error Handling: Comprehensive error management flows
- ๐ก๏ธ Security Stack: Middleware and protection layers
- ๐ง Technology Stack: Complete dependency mapping
- OAuth Flow: Login โ Token exchange โ Repository access
- Branch Operations: Create, search, delete across multiple repos
- Pull Request Search: Find PRs by base branch
- Error Handling: Test rate limits, invalid inputs, network errors
npm test # Run test suite (when implemented)We welcome contributions! Here's how to get started:
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make changes following our coding standards
- Test thoroughly
- Submit a pull request
- Follow existing code style and patterns
- Add comments for complex logic
- Update documentation for new features
- Ensure security best practices
- Test across different environments
# Check application status
curl -k https://localhost:3000/health
# View logs
tail -f logs/git-captain-$(date +%Y-%m-%d).log| Issue | Solution |
|---|---|
| Port 3000 in use | lsof -i :3000 and kill process |
| SSL certificate errors | Regenerate certificates or check paths |
| Rate limit 429 errors | Wait or increase limits in middleware.js |
| OAuth callback issues | Verify GitHub OAuth app callback URL |
This project is licensed under the MIT License - see the LICENSE file for details.
- Node.js โ JavaScript runtime
- Express.js โ Web framework
- GitHub API โ Repository integration
- Axios โ HTTP client
- Helmet.js โ Security middleware
- Winston โ Logging framework
- ConfusedDeer โ Original creator and maintainer
- CrunchyFerrett โ Early frontend development
- Community Contributors โ Various improvements and bug fixes
- j4p4n โ "Titanic Captain" image from openclipart.org under CC0 License
- Shining Light Productions โ OpenSSL Windows installer
- GitHub Community โ For the robust API and OAuth system
- Multi-organization support
- Webhook integration for automated workflows
- Branch protection rule management
- Bulk repository creation
- Advanced filtering and search
- REST API for external integration
- Docker Compose for easy deployment
- Comprehensive test suite
- Mobile-responsive PWA
- Real-time collaboration features
- Integration with CI/CD platforms
- Advanced analytics and reporting
โญ Star this repository if Git-Captain helps you manage your repositories more efficiently!
