Jake McMurchie saxophonist and Wordpress developer

Jake McMurchie

Connecting a new git repository to Bitbucket

Whenever I start a new project (or sub-project, such as a new custom plugin for a WordPress site I’m working on) I almost always create a new git repository for it. But I’m forever forgetting the process for connecting the two. So here’s how I do it.

Initial context

What I do first…

In Bitbucket…

Back in terminal on my local machine…

Note, the --force flag will delete whatever was in the remote repo, so don’t use this for repositories where there are already commits and content

Next time you push, you may have to align the branches with:
>git push --set-upstream origin main
…as you would with a new branch.

.gitignore

# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
#     https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Log files
*.log

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv

# Environment variables
config/