rpi-brother-printer-setup/git.md
시골약사 9efd731f98 Initial commit: Raspberry Pi CUPS 브라더 프린터 설정 리포지토리
 주요 목적:
- 라즈베리파이 3B+에서 브라더 프린터 CUPS 설정
- wget으로 브라더 프린터 드라이버(gz) 쉽게 다운로드
- 프린터 설정 자동화 스크립트 및 문서 제공

📦 포함 파일:
- linux-brprinter-installer-2.2.6-0.gz: 브라더 프린터 드라이버
- 각종 설정 문서 (COM 포트, Samba 마운트, 동기화 등)
- Gitea 저장소 가이드

🔧 기술 스택:
- Raspberry Pi OS
- CUPS (Common Unix Printing System)
- Brother printer driver

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-04 14:02:02 +00:00

6.1 KiB

Gitea 리포지토리 생성 및 푸시 가이드

🏠 서버 정보

  • Gitea 서버: git.0bin.in
  • 사용자명: thug0bin
  • 이메일: thug0bin@gmail.com
  • 액세스 토큰: d83f70b219c6028199a498fb94009f4c1debc9a9

🚀 새 리포지토리 생성 및 푸시 과정

1. 로컬 Git 리포지토리 초기화

# 프로젝트 디렉토리로 이동
cd /path/to/your/project

# Git 초기화
git init

# .gitignore 파일 생성 (필요시)
cat > .gitignore << 'EOF'
# Dependencies
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Build outputs
dist/
build/

# Environment variables
.env
.env.local
.env.development.local
.env.test.local
.env.production.local

# IDE
.vscode/
.idea/

# OS
.DS_Store
Thumbs.db

# Logs
*.log

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/

# Database
*.db
*.sqlite
*.sqlite3
EOF

2. Git 사용자 설정 확인

# Git 사용자 정보 확인
git config --list | grep -E "user"

# 설정되지 않은 경우 설정
git config --global user.name "시골약사"
git config --global user.email "thug0bin@gmail.com"

3. 첫 번째 커밋

# 모든 파일 스테이징
git add .

# 첫 커밋 (상세한 커밋 메시지 예시)
git commit -m "$(cat <<'EOF'
Initial commit: [프로젝트명]

✨ [주요 기능 설명]
- 기능 1
- 기능 2
- 기능 3

🛠️ 기술 스택:
- 사용된 기술들 나열

🔧 주요 구성:
- 프로젝트 구조 설명

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
EOF
)"

4. 원격 리포지토리 연결 및 푸시

# 원격 리포지토리 추가 (리포지토리명을 실제 이름으로 변경)
git remote add origin https://thug0bin:d83f70b219c6028199a498fb94009f4c1debc9a9@git.0bin.in/thug0bin/[REPOSITORY_NAME].git

# 브랜치를 main으로 변경
git branch -M main

# 원격 리포지토리로 푸시
git push -u origin main

📝 리포지토리명 네이밍 규칙

권장 네이밍 패턴:

  • 프론트엔드 프로젝트: project-name-frontend
  • 백엔드 프로젝트: project-name-backend
  • 풀스택 프로젝트: project-name-fullstack
  • 도구/유틸리티: tool-name-utils
  • 문서/가이드: project-name-docs

예시:

  • figma-admin-dashboard
  • anipharm-api-server
  • inventory-management-system
  • member-portal-frontend

🔄 기존 리포지토리에 추가 커밋

# 변경사항 확인
git status

# 변경된 파일 스테이징
git add .

# 또는 특정 파일만 스테이징
git add path/to/specific/file

# 커밋
git commit -m "커밋 메시지"

# 푸시
git push origin main

🌿 브랜치 작업

# 새 브랜치 생성 및 전환
git checkout -b feature/new-feature

# 브랜치에서 작업 후 커밋
git add .
git commit -m "Feature: 새로운 기능 추가"

# 브랜치 푸시
git push -u origin feature/new-feature

# main 브랜치로 돌아가기
git checkout main

# 브랜치 병합 (필요시)
git merge feature/new-feature

🛠️ 자주 사용하는 Git 명령어

# 현재 상태 확인
git status

# 변경 내역 확인
git diff

# 커밋 히스토리 확인
git log --oneline

# 원격 리포지토리 정보 확인
git remote -v

# 특정 포트 프로세스 종료 (개발 서버 관련)
lsof -ti:PORT_NUMBER | xargs -r kill -9

🔧 포트 관리 스크립트

# 특정 포트 종료 함수 추가 (bashrc에 추가 가능)
killport() {
    if [ -z "$1" ]; then
        echo "Usage: killport <port_number>"
        return 1
    fi
    lsof -ti:$1 | xargs -r kill -9
    echo "Killed processes on port $1"
}

# 사용 예시
# killport 7738
# killport 5000

📋 VS Code 워크스페이스 설정

여러 리포지토리를 동시에 관리하려면 워크스페이스 파일을 생성하세요:

{
	"folders": [
		{
			"name": "Main Repository",
			"path": "."
		},
		{
			"name": "New Project",
			"path": "./new-project-folder"
		}
	],
	"settings": {
		"git.enableSmartCommit": true,
		"git.confirmSync": false,
		"git.autofetch": true
	}
}

🚨 문제 해결

1. 인증 실패

# 토큰이 만료된 경우, 새 토큰으로 원격 URL 업데이트
git remote set-url origin https://thug0bin:NEW_TOKEN@git.0bin.in/thug0bin/repo-name.git

2. 푸시 거부

# 원격 변경사항을 먼저 가져오기
git pull origin main --rebase

# 충돌 해결 후 푸시
git push origin main

3. 대용량 파일 문제

# Git LFS 설정 (필요시)
git lfs install
git lfs track "*.zip"
git lfs track "*.gz"
git add .gitattributes

📊 커밋 메시지 템플릿

기본 템플릿:

타입: 간단한 설명

상세한 설명 (선택사항)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

타입별 예시:

  • ✨ feat: 새로운 기능 추가

  • 🐛 fix: 버그 수정

  • 📝 docs: 문서 업데이트

  • 🎨 style: 코드 포맷팅

  • ♻️ refactor: 코드 리팩토링

  • ⚡ perf: 성능 개선

  • ✅ test: 테스트 추가

  • 🔧 chore: 빌드 설정 변경

🔗 유용한 링크

💡 팁과 모범 사례

  1. 정기적인 커밋: 작은 단위로 자주 커밋 하세요
  2. 의미있는 커밋 메시지: 변경 사항을 명확히 설명하세요
  3. 브랜치 활용: 기능별로 브랜치를 나누어 작업하세요
  4. .gitignore 활용: 불필요한 파일은 제외하세요
  5. 문서화: README.md와 같은 문서를 항상 업데이트하세요

작성일: 2025년 7월 29일
마지막 업데이트: 토큰 및 서버 정보 최신화
참고: 이 가이드는 재사용 가능하도록 작성되었습니다. 새 프로젝트마다 참고하세요.

💡 중요: 액세스 토큰은 보안이 중요한 정보입니다. 공개 저장소에 업로드하지 마세요!