Here are the steps to create a GitHub repository for a custom Odoo module, following the “Standard Module Structure + Proper Git Workflow”​ principle. The process is divided into three main stages: local preparation, creating the remote repository, and pushing the code.

1. Local Preparation: Ensure a Standard Module Structure

Before pushing, verify that your local module directory follows Odoo conventions.
  1. Module Directory Structure
    A typical Odoo module includes these core files (example module: my_custom_module):
    my_custom_module/       # Module root directory
    ├── __init__.py         # Empty file or imports
    ├── __manifest__.py     # Module metadata (MANDATORY)
    ├── models/             # Models directory (optional)
    │   ├── __init__.py
    │   └── my_model.py
    ├── views/              # Views/XML directory (optional)
    │   └── my_view.xml
    └── static/             # Static assets (optional)
    • Key File: __manifest__.pymust exist with name, version, etc.
  2. Initialize Local Git (if not done)
    If your module isn’t yet a Git repository:
    cd /path/to/my_custom_module
    git init
    git add .
    git commit -m "Initial commit: add my_custom_module"

2. GitHub Actions: Create the Remote Repository

Perform this on GitHub’s website. Use the “Empty Repository”​ strategy to avoid conflicts with existing local files.
  1. Create New Repository
    Log in to GitHub, click +New repository.
  2. Configure Settings
    • Repository name: Match your module name (e.g., my_custom_module).
    • Visibility: Choose Public(open source) or Private.
    • Initialization Options: Crucially, leave ALL checkboxes UNCHECKED​ (README, .gitignore, license). We’ll push existing code.
  3. Create
    Click Create repository. Copy the provided repository URL (e.g., https://github.com/yourname/my_custom_module.git).

3. Link & Push: Connect Local to Remote

In your local terminal, link your repository and push the code.
  1. Add Remote Origin
    git remote add origin https://github.com/yourname/my_custom_module.git
    Tip: If you have SSH keys set up, use git@github.com:yourname/my_custom_module.gitinstead.
  2. Push Code
    git branch -M main          # Rename master branch to main (GitHub default)
    git push -u origin main    # First push; sets upstream tracking
    If push is rejected, remote may have initialization files. Try: git pull origin main --rebaseto merge, then push again.

4. Odoo Project Best Practices (Advanced)

For multi‑module projects or production deployments, consider this more professional structure:
  • Multi‑Module Repository Structure: Push only your custom modules, not the entire Odoo source.
    odoo-custom/                # Project root
    ├── .gitignore             # Ignore logs, caches, etc.
    └── addons/                # All custom modules
        ├── module_a/
        ├── module_b/
        └── ...
  • Branch Strategy: Create branches per Odoo version (e.g., 16.0, 17.0) for easier compatibility management.
  • .gitignore: Highly recommended. Ignore *.pyc, __pycache__, .log, and other temporary files.

Troubleshooting

  • Push fails: Verify remote URL (git remote -v) and network connection.
  • Module not appearing in Odoo: Ensure __manifest__.pyexists and has correct syntax.
  • Permission errors: For private repos, check GitHub account access or use a Personal Access Token.
Once done, refresh your GitHub page to see your Odoo module. For future updates, use git add, git commit, and git push.
git push repository not found because i set it private?
Yes, a private repository is likely the cause of the “repository not found” error when you try to git push.
GitHub returns this generic error for both permission issues​ (private repos) and incorrect URLs​ to prevent information leakage about private repositories’ existence.

Solutions for Private Repository Access

Option 1: Use GitHub Personal Access Token (PAT) – Most Common

Since 2021, GitHub requires tokens instead of passwords for command-line authentication.
  1. Generate a PAT:
    • Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
    • Click “Generate new token” → “Generate new token (classic)”
    • Give it a descriptive name (e.g., “Odoo Module Push”)
    • Set expiration (recommend 90 days for security)
    • Select scopes: at minimum repo​ (full control of private repositories)
    • Generate token → COPY THE TOKEN IMMEDIATELY​ (you won’t see it again!)
  2. Use the token in your Git command:
    git push https://<YOUR_TOKEN>@github.com/yourusername/my_custom_module.git main
    Or update your remote URL:
    git remote set-url origin https://<YOUR_TOKEN>@github.com/yourusername/my_custom_module.git
    git push origin main

Option 2: Use SSH Keys (Recommended for Frequent Use)

SSH is more secure and convenient once set up.
  1. Check for existing SSH keys:
    ls -la ~/.ssh/
    # Look for id_ed25519.pub or id_rsa.pub
  2. Generate a new SSH key (if needed):
    ssh-keygen -t ed25519 -C "your-email@example.com"
    # Press Enter to accept default location
  3. Add SSH key to GitHub:
    cat ~/.ssh/id_ed25519.pub
    # Copy the entire output
    • GitHub → Settings → SSH and GPG keys → New SSH key
    • Paste the key, give it a title, click “Add SSH key”
  4. Test SSH connection:
    ssh -T git@github.com
    # Should see: "Hi username! You've successfully authenticated..."
  5. Update remote to use SSH:
    git remote set-url origin git@github.com:yourusername/my_custom_module.git
    git push origin main

Option 3: Use GitHub CLI (Simplest for Beginners)

Install GitHub CLI (gh) and authenticate:
# Install gh (varies by OS)
# Ubuntu/Debian: sudo apt install gh
# macOS: brew install gh
# Windows: winget install GitHub.cli

# Authenticate
gh auth login
# Follow prompts: choose GitHub.com → SSH or HTTPS → authenticate

# Then push
git push origin main

Quick Diagnostic Steps

  1. Verify remote URL:
    git remote -v
    # Should match your repository URL exactly
  2. Check repository existence:
    # Try to clone (will fail if no access, but different error)
    git ls-remote https://github.com/yourusername/my_custom_module.git
  3. Test with a simple command:
    # For HTTPS URLs, GitHub will prompt for credentials
    curl -I https://github.com/yourusername/my_custom_module.git

Common Mistakes to Check

  1. Typos in username/repo name: youusernamevs yourusername
  2. Using .git twice: my_custom_module.git.git
  3. Case sensitivity: GitHub usernames are case-sensitive
  4. Wrong protocol: Mixed HTTPS/SSH configurations

Quick Fix Checklist

  • [ ] Repository is actually private (check on GitHub)
  • [ ] You’re logged into the correct GitHub account
  • [ ] Your account has push access to the repository
  • [ ] You’re using a token (not password) for HTTPS
  • [ ] Or you’ve set up SSH keys correctly
Recommendation: Use SSH keys​ (Option 2) for long-term development. It’s more convenient and secure than tokens. Once set up, you won’t need to enter credentials repeatedly.
https://github.com/techieshop/rsw_leagcy_sync/ really not found via browser
Yes, you are right. The link https://github.com/techieshop/rsw_leagcy_sync/is returning a 404 Not Found​ error, which means the repository is inaccessible via the browser.
This is not a permissions issue (like a private repo you don’t have access to); it means the resource genuinely does not exist at that URL.

Why This Happens

  • Typo in URL: The most common cause is a misspelling. Notice the word leagcyin the URL—it should likely be legacy.
  • Repository Deleted/Moved: The owner may have deleted the repo or renamed it.
  • Incorrect Case: GitHub usernames and repo names are case-sensitive. techieshopmight be Techieshopor RSW_Leagcy_Sync.

What You Can Do

  1. Check for Typos: Ask the person who gave you the link to confirm the exact spelling and case.
  2. Search Manually: Go to github.comand search for rsw syncor techieshopto see if a similar repository exists under a different name.
  3. Contact the Source: If this link came from documentation or a colleague, inform them that the repository link is broken.
Since you are in Hong Kong, this is not​ a regional network/DNS issue (which sometimes affects mainland China). This is purely a “resource not found” error on GitHub’s side.

Sources

请将上一条回答翻译成英文
GitHub上如何查找已删除的仓库?
如果仓库名称包含特殊字符,应该如何处理?

Download the desktop version of Yuanbao and experience the efficient AI assistant

the same https://github.com/techieshop/rsw_leagcy_sync/ can visit on other computer?
Based on the information provided in the 链接内容, the answer is No. The provided link (https://github.com/techieshop/rsw_leagcy_sync/) cannot be visited on any computer, as it is a broken or non-existent link.
The linked content is the standard GitHub “Page not found” error page. This is a universal response from GitHub’s servers, indicating that the resource at that specific URL does not exist on their platform. The issue is with the repository itself, not with your device or network.

Why This is a Universal Issue:

  1. Repository Does Not Exist: The error page (Page not found · GitHub) confirms that GitHub cannot find a repository with the exact name rsw_leagcy_syncunder the user/organization techieshop.
  2. Typo in URL (Most Likely): The word leagcyin the URL appears to be a misspelling of legacy. Therefore, the correct link might be something like https://github.com/techieshop/rsw_legacy_sync/.
  3. Other Possibilities: The repository may have been deleted, renamed, or set to private. However, the standard “Page not found” error for a non-logged-in user primarily indicates the resource is not publicly accessible at that address.

What You Can Try:

  1. Confirm the URL: Reach out to the person who shared the link and ask them to verify the exact spelling. The most likely fix is correcting leagcyto legacy.
  2. Manual Search on GitHub: Visit github.com/techieshopto see the list of that user’s public repositories, or use the GitHub search bar to look for terms like “rsw sync”.
  3. Access on Another Computer (to prove the point): You can try accessing the same broken link on another computer. The result will be identical—you will see the same “Page not found” error. This confirms the problem is with the link itself, not your local setup.
In summary, the provided GitHub link is invalid. Until the correct URL is provided, it will not be accessible on any computer or browser.
yes, misspelt, how correct it
Based on the URL provided (https://github.com/techieshop/rsw_leagcy_sync/), the likely misspelling is the word “leagcy”. The correct spelling should be “legacy”.
How to correct the URL:
  1. Corrected URL:
    https://github.com/techieshop/rsw_legacy_sync/
  2. How to proceed:
    • Copy the corrected URL above and paste it into your browser.
    • If you are trying to clone the repository using Git, update the URL in your command or Git configuration:
      # If you have already set the remote URL incorrectly, correct it with:
      git remote set-url origin https://github.com/techieshop/rsw_legacy_sync/
      Then try accessing/cloning again.
Additional Notes:
  • Sometimes repository names may have other variations, such as using underscores differently (rsw-legacy-sync) or a different case (RSW_Legacy_Sync). If the corrected URL above still does not work, please ask the source of the link for the exact, case-sensitive repository name.
  • The error message you received (“Page not found”) is consistent with a simple typo in the URL. Fixing the spelling should resolve the issue.
no change the repository name
Based on the provided information, I understand that you want to access the repository at the given URL (https://github.com/techieshop/rsw_leagcy_sync/) but are unable to do so, and you do not want to change the repository name.
Looking at the 链接内容​ you provided, it clearly shows a standard GitHub “Page not found” error page. This indicates that the repository with the exact name rsw_leagcy_syncunder the user/organization techieshopdoes not exist publicly on GitHub.
Since the document content (GitHub’s 404 error page) confirms the repository is not found, and you’re unwilling to change the repository name, here are your options:
  1. Contact the repository owner: Reach out to the user/organization techieshopto confirm:
    • The correct repository name and spelling
    • Whether the repository exists and is accessible
    • If it’s a private repository that requires access permissions
  2. Check for alternative access methods:
    • If you have the correct repository URL but it’s private, you’ll need to be added as a collaborator or have the owner grant you access
    • Ask the owner to verify the exact case-sensitive URL
  3. Search for the repository manually:
    • Go to github.com/techieshopto see all their public repositories
    • Use GitHub’s search feature to look for repositories containing “rsw” or “sync” under that user
  4. Wait for the owner to fix the issue:
    • The repository might have been temporarily unavailable, renamed, or deleted
    • Check back later to see if it becomes accessible
Document未详述此点,但基于我所掌握的知识:GitHub repository names are case-sensitive and must match exactly. If the repository name contains a typo (like “leagcy” instead of “legacy”), and you’re not allowed to correct it, you cannot access that specific repository URL unless the owner renames their repository to match the incorrect spelling you have.
Without changing the repository name in your URL, you will continue to receive the “Page not found” error shown in the document content. The only solution is to obtain the correct repository name from the owner.
how change repository name
To change a GitHub repository name, you must be the owner​ or have admin​ permissions to that repo. If you are a collaborator with only write access, you cannot rename it.

Steps to Rename a Repository on GitHub

  1. Go to Settings: Navigate to your repository on GitHub. Click on the “Settings”​ tab (located in the top menu, next to “Code”, “Issues”, etc.).
  2. Edit the Name: In the “Repository name” field (under the “General” section), delete the current name and type the new name.
  3. Confirm: Click the “Rename”​ button (usually green) at the bottom of the section. GitHub will apply the change immediately.

Important Notes & Next Steps

  • Automatic Redirects: After renaming, the old URL will automatically redirect to the new one for web traffic (issues, wiki, stars will be preserved).
  • Update Your Local Git​ (Critical): Your local git clone will still point to the old URL. You must update the remote URL in your local terminal:
    git remote set-url origin https://github.com/yourname/new-repo-name.git
    After this, git pushand git pullwill work normally again.
  • Case Sensitivity: Repository names are case-sensitive. My-Repoand my-repoare considered different.

Regarding Your “rsw_leagcy_sync” Issue

If you are trying to fix the repository techieshop/rsw_leagcy_syncthat you mentioned earlier, please note:
  • You Cannot Rename It: Since you are not the owner of the techieshoporganization, you do not have permission to rename their repository.
  • Solution: You must contact the techieshop​ admin and ask them to either:
    1. Rename the repository to the correct spelling (rsw_legacy_sync), or
    2. Grant you admin access so you can do it yourself.

Sources

请将上一条回答翻译成中文
GitHub上如何重命名仓库并保留所有分支?
如果仓库名称包含大写字母,重命名时需要注意什么?

Download the desktop version of Yuanbao and experience the efficient AI assistant

i m owner
Based on your confirmation that you are the owner of the techieshop/rsw_leagcy_syncrepository, here are the direct steps to rename it, as outlined in the GitHub error page content you provided.
Steps to Rename Your Repository (as the Owner):
  1. Navigate to Settings:​ Go to your repository on GitHub (https://github.com/techieshop/rsw_leagcy_sync). In the top horizontal menu (which includes “Code”, “Issues”, “Pull requests”), click on the “Settings”​ tab.
  2. Rename the Repository:​ On the Settings page, look for the “Repository name”​ field under the “General” section. Delete the current name rsw_leagcy_syncand type the correct new name, for example, rsw_legacy_sync.
  3. Confirm the Change:​ Click the green “Rename”​ button. GitHub will apply the change instantly.
What Happens Next:
  • The main repository page will now be accessible at the new URL (e.g., https://github.com/techieshop/rsw_legacy_sync).
  • The old URL (.../rsw_leagcy_sync/) will automatically redirect​ to the new one for all web traffic (like issues, wiki, stars).
  • Important Local Update:​ Any existing local clones of this repository on your or your collaborators’ computers will break. Everyone must run this command in their local repository directory to update the remote URL:
    git remote set-url origin https://github.com/techieshop/rsw_legacy_sync.git
    After this, git pushand git pullwill work again.
Since the provided link content shows the standard GitHub 404 page, successfully renaming the repository as described above will resolve the “Page not found” error for anyone trying to access it with the corrected name.
what is git fetch
Git Fetch​ is a command that downloads new data (commits, branches, tags) from a remote repository without merging them​ into your local branches. Think of it as a “check for updates” command that lets you see what others have done before deciding to integrate their changes.

Key Characteristics of git fetch:

  1. Safe & Non-Destructive: Fetch only updates your remote-tracking branches​ (like origin/main), not your local branches​ (like main).
  2. View Changes First: It lets you review what’s changed remotely before deciding to merge or rebase.
  3. Synchronization: Updates your local copy of what exists in the remote repository.

How It Works: Local vs Remote Branches

Remote Repository (GitHub)
    └── main (someone pushed new commits)
            ↓ fetch downloads
Your Local Repository
    ├── origin/main (updated by fetch)
    └── main (your local branch, unchanged)

Common Usage Examples

# Fetch all changes from ALL remote branches
git fetch origin

# Fetch from a specific remote
git fetch

# Fetch and prune: delete local refs to branches that no longer exist on remote
git fetch --prune

# Fetch specific branch only
git fetch origin feature-branch

# Fetch all tags
git fetch --tags

Git Fetch vs Git Pull

Action
What It Does
Result
git fetch
Downloads remote changes
Updates origin/branch-nameonly
git pull
git fetch+ git merge
Updates your local branch-name
# These are equivalent:
git pull origin main
# is the same as:
git fetch origin
git merge origin/main

Why Use git fetchInstead of git pull?

  1. Safety First: Review changes before merging
  2. Inspect Differences: See what changed before integrating
  3. Avoid Surprises: No automatic merges that might break your code
  4. Better Workflow: Decide when and how to integrate changes

Practical Example

# 1. Check your current status
git status

# 2. Fetch latest changes from remote
git fetch origin

# 3. See what changed (compare local vs remote)
git log origin/main..main  # What you have that remote doesn't
git log main..origin/main  # What remote has that you don't

# 4. See differences in a specific file
git diff main origin/main -- path/to/file.py

# 5. Once satisfied, integrate the changes
git merge origin/main
# OR
git rebase origin/main

Visual Representation

After git fetch:
  • Remote branch on server: main→ [A]─[B]─[C]─[D]
  • Your local: origin/main→ [A]─[B]─[C]─[D] (updated by fetch)
  • Your local: main→ [A]─[B]─[E] (your work, unchanged)

Common Scenarios for Odoo Development

# 1. Check if teammates pushed new modules
git fetch
git log --oneline origin/main -- modules/

# 2. Review a PR before merging
git fetch origin pull/123/head:pr-123
git checkout pr-123

# 3. Update your feature branch safely
git checkout my-feature
git fetch origin
git rebase origin/main  # Reapply your commits on top of latest main

# 4. Clean up deleted branches
git fetch --prune

Best Practices

  1. Fetch Frequently: git fetchregularly to stay updated
  2. Fetch Before Push: Avoid push rejections
  3. Use Fetch in Scripts: Safer than pull in automation
  4. Combine with git log: See what you’ll get before merging

TL;DR

  • git fetch​ = “Download updates but don’t apply them”
  • git pull​ = “Download updates AND apply them immediately”
  • Use fetchwhen you want to review changes first
  • Use pullwhen you trust the remote changes and want to update immediately
For Odoo development, git fetchis especially useful when you want to check if there are new module updates or migrations before merging them into your working environment.

Solution: Use .gitignoreFile

The correct approach is to prevent __pycache__from being tracked by Git​ in the first place, rather than skipping it during push. This is done using a .gitignorefile.

Step 1: Create/Edit .gitignoreFile

Create a file named .gitignorein your repository’s root directory with these contents:
# Python cache files
__pycache__/
*.py[cod]
*$py.class

# Byte-compiled / optimized / DLL files
*.pyc
*.pyo
*.pyd

Step 2: For Odoo-Specific Projects

For Odoo projects, add these additional patterns:
# Odoo-specific
*.log
*.pot
*.po~
*.mo
*.pyc
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
*.egg
*.manifest
*.spec
pip-log.txt
pip-delete-this-directory.txt
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
.pytest_cache/
*.sql
*.sql.gz
*.sql.zip
*.txt

Step 3: Apply to Existing Repository

If you’ve already committed __pycache__files:
# 1. Add .gitignore file
git add .gitignore
git commit -m "Add .gitignore to exclude __pycache__"

# 2. Remove __pycache__ from Git (but keep locally)
git rm -r --cached */__pycache__  # Remove from all subdirectories
git rm -r --cached __pycache__    # Remove from root directory

# 3. Commit the removal
git commit -m "Remove __pycache__ directories from tracking"

# 4. Push changes
git push origin main

Step 4: Verify

To ensure __pycache__is ignored:
# Check git status - shouldn't show __pycache__
git status

# Force check
git check-ignore -v path/to/__pycache__/

Alternative: Global Git Ignore

You can also set a global .gitignorefor all repositories:
# Create global .gitignore
echo "__pycache__/" >> ~/.gitignore_global
echo "*.pyc" >> ~/.gitignore_global

# Configure Git to use it
git config --global core.excludesfile ~/.gitignore_global

Important Notes

  1. Don’t Use git add .Blindly: Instead, use:
    git add --all :!__pycache__  # Add all except __pycache__
    Or better:
    git add .
    git reset -- __pycache__/  # Unstage __pycache__ before commit
  2. Odoo-Specific Best Practice: Always commit a comprehensive .gitignorefor Odoo projects to exclude:
    • Cache files (__pycache__/, *.pyc)
    • Log files
    • Session data
    • Database dumps
    • IDE files (.vscode/, .idea/)
  3. If Already Pushed Accidentally:
    # Remove from Git and remote
    git rm -r --cached __pycache__
    git commit -m "Remove __pycache__"
    git push origin main
    
    # Add to .gitignore to prevent future commits
    echo "__pycache__/" >> .gitignore
    git add .gitignore
    git commit -m "Add __pycache__ to .gitignore"
    git push origin main