python/README_GITEA_PUSH.md

91 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Quick Start: Push Local Repo to Gitea
## 1. Create repo on Gitea
- Log in → **`+` → New Repository**
- Enter repo name → click **Create Repository**
---
## 2. Initialize your local repo
```bash
cd ~/projects/myproject
git init
git add .
git commit -m "Initial commit"
```
---
## 3. Add the remote
Copy the HTTPS or SSH URL from Gitea:
```bash
git remote add origin https://gitcenter.dancalloway.com/dancalloway/Python_Projects.git
```
(or SSH: `git@gitcenter.dancalloway.com:dancalloway/Python_Projects.git`)
---
## 4. Push your branch
If your branch is `main`:
```bash
git push -u origin main
```
If your branch is `Main`: [Our branch is Main -uppercase M]
```bash
git push -u origin Main
```
---
## 5. Done
- `git push` → send changes up
- `git pull` → fetch changes down
- Repeat `add` + `commit` + `push` as you work
---
⚠️ **Important**:
- Repos **must be created on Gitea first**. Pushing to a non-existent repo wont work (push-to-create is disabled).
- Branch names are **case-sensitive** (`main` ≠ `Main`).
---
# 🛠️ Troubleshooting Common Git Errors
**1. Error: `fatal: remote origin already exists`**
👉 You already added a remote. Fix with:
```bash
git remote set-url origin https://gitcenter.dancalloway.com/dancalloway/Python_Projects.git
```
---
**2. Error: `non-fast-forward` (push rejected)**
👉 Your local branch is behind the remote. Update first:
```bash
git pull --rebase origin main
git push
```
---
**3. Error: `push to create not enabled`**
👉 You tried pushing to a repo that doesnt exist. Create it on Gitea first, then retry.
---
**4. Error: `authentication failed`**
👉 Check your username/password or SSH key.
- For HTTPS: use your **Gitea username + password (or token)**.
- For SSH: ensure your public key is added under **Profile → Settings → SSH / GPG Keys**.
---
**5. Wrong branch pushed (e.g. `Main` vs `main`)**
👉 Branch names are case-sensitive. Rename if needed:
```bash
git branch -m Main main
git push -u origin main
```