Connecting Netbeans and Bitbucket with Git – version 1

So I want to create a new Laravel project, hosted in BitBucket, and set it up as a project in Netbeans. Shouldn’t be that hard, right? Well, there are a few gotchas. (Spoiler: I don’t actually use this idea – I ended up going with version 3.)

Creating a new Laravel project in BitBucket

First, I logged in to BitBucket and went Repositories -> Import repository and imported to create a new repo. Then I deleted all the branches except master. Not because they’re not important, because they’re not relevant to my project.

Getting the project into Netbeans

Then I went to Netbeans and went Team -> Git -> Clone and typed in the repo URL  I entered my Private Key File C:\Users\username\.ssh\id_rsa (I had already put my public key in BitBucket). And I got an an “Auth cancel” error. The secret is that you need the username “git” (not your actual username) in the Netbeans Remote Repository window. Which makes sense in retrospect, but I’m sure glad I found this Netbeans bug. Cos I sure as heck didn’t work it out by myself.

The username has to be "git".
The username has to be “git”.

Then hit OK a lot. When it asks if you want to create an IDE project, click Create Project, and give it a name. Then (and this is important) you need to fire up the command line and go to the root of your project, and type composer install.  Of course if you haven’t installed Composer yet, you’ll need to do that first.  🙂 Then you need to do a bit of tweaking…

Tweaking the project for Netbeans

You’ll want to exclude the nbproject/private directory from your Git repo. To do this, edit the .gitignore file to add the line /nbproject/private/ (with leading and trailing slashes) at the bottom. Because the stuff in that directory needs to be … well … private. And that’s it – you’ve got a new Laravel project set up in Bitbucket, and also in Netbeans. Next, I’ll set up my development environment… but that’s a topic for a different post.

Why I didn’t use this…

After getting all this working, I then started setting up branches in a Git client … and realised that I had all the branches and commits from the Laravel project mixed in with my project. (I had cloned the Laravel dev project, after all). And I don’t want that. So I then deleted this project out of my local machine and also off BitBucket, and started all over again.

Connecting Netbeans and Bitbucket with Git – version 1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s