Search code examples
wordpressgitphpstormbitbucket

How to set up Bitbucket in PhpStorm 2019


The terms Git, repository, commit and push are completely new to me but I want to set up a version control system for my WordPress website.

I use PhpStorm and want to use Bitbucket - how would I do this?

(I've spent the afternoon answering the above question so will share below)


Solution

  • Step 1: Install Bitbucket Linky using this guide. Note Bitbucket Connector is no longer being developed.

    Step 2: Set up a new private repository on Bitbucket. If you're using Wordpress, I'd recommend creating a repository for each plugin you are developing, rather than for the entire install. Leave it empty for now.

    Step 3 Create a new project in PHPStorm or use an existing one. Click VCS>Create Git Repository. Select the path of your project.

    Step 4 Now the repository is properly set up, I then added - using Finder - all of my files into the local repository folder.

    Step 5 Select all of your project - which should be in red text - and click VCS>Git>Add. This will have added these files to the project, but not yet pushed them to the remote server.

    Step 6 Now select the root directory of your project and click VCS>Git>Commit Directory.

    Step 7 Go to VCS>Git>Remotes and add a new remote. You need to get this in Bitbucket by clicking 'I will be starting from scratch' and then copying the URL (https://[email protected]/youraccount/yourrepo.git) and pasting it into PHPStorm.

    Step 8 Click VCS>Git>Push. This actually moves the files to the server.

    Hope that helps some one - took me ages to figure out. You're now in the capable hands of many guides on how to use Git.