CMSC433 Solving Project 0 Getting started with BitBucket, Git and Eclipse bitbucket • Creating an account – https://bitbucket.org/ CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 2 bitbucket • Creating an account – https://bitbucket.org/ – Sign up now, free CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 3 bitbucket • Creating an account – https://bitbucket.org/ – Sign up now, free – Validate email address • If you use your .edu address, you get the Unlimited Community License for Free! – Done? • Not yet: don’t forget to update your first and last name in the account preferences! CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 4 Let’s get Project 0! • Open the class BitBucket address: – https://bitbucket.org/cmsc433_spring2012/projec t0 • Fork Project 0 – Don’t forget to concatenate your Directory ID to your forked repository! CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 5 Let’s get Project 0! • Now you’re… almost ready to get the project skeleton code on your machine! – Before you can do it, you have to get a Git client first… CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 6 Git • Download a Git client. Tutorials for all: – Windows 7: http://confluence.atlassian.com/display/BITBUCK ET/Set+up+Git+and+Mercurial – Mac OSX: http://confluence.atlassian.com/pages/viewpage. action?pageId=269981802 – Linux (Ubuntu): http://confluence.atlassian.com/pages/viewpage. action?pageId=269982882 CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 7 Git (Windows users) • You will need msysgit (1.7.8) – http://code.google.com/p/msysgit/downloads/list CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 8 Git (Windows users) • You will need msysgit (1.7.8) – http://code.google.com/p/msysgit/downloads/list CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 9 Git (Windows users) • Some tricks – Set the Git home directory (by default, it’s C:\Users\<username>): • Create a directory with this purpose (for example, D:\CMSC433\Git) • Create a HOME environment variable CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 10 Git (Windows users) • Some tricks – Set up your name and email (so they appear nicely in BitBucket when you make changes to your repository) • In Git Bash, type the commands: – git config --global user.name “<first name> <last name>“ – git config --global user.email “<your_email>@umd.edu“ – (notice that Git creates a file called .gitconfig with the information you provided) CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 11 Let’s get Project 0! • Now you’re… almost ready to get the project skeleton code on your machine! – In the repository page, look for the HTTPS link… CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 12 Let’s get Project 0! • Now you’re… almost ready to get the project skeleton code on your machine! – In the repository page, look for the HTTPS link… – Copy it, and paste it in the Git command window. Git will create a clone of the repository on your local machine… • … but how annoying: you need to supply the password for your account. Can we get rid of that? CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 13 Git (Windows users) • Let’s create a default ssh identity. – Run the command: ssh-keygen CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 14 Git (Windows users) • Let’s create a default ssh identity. – Create a config file (indentation is important) (~/.ssh/config): – Restart your Git bash terminal CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 15 Git (Windows users) • Let’s create a default ssh identity. – Let BitBucket know about your ssh identity: • In your Account Settings page, look for the SSH keys section CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 16 Git (Windows users) • Let’s create a default ssh identity. – Let BitBucket know about your ssh identity: • In your Account Settings page, look for the SSH keys section • Open the public key generated by ssh-keygen. (For example, D:\CMSC433\Git\.ssh\id_rsa.pub) • Paste the contents into the text box, and click Add Key CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 17 Let’s get Project 0! • Now you’re… almost ready to get the project skeleton code on your machine! – In the repository page, look for the HTTPS SSH link… – Copy it, and paste it in the Git command window. Git will create a clone of the repository on your local machine! CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 18 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – File > Import > General > Existing Projects into Workspace • Or… use magic: CTRL+3 CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 19 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – File > Import > General > Existing Projects into Workspace – Select root directory: • (point to the path where you cloned the project) CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 20 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – File > Import > General > Existing Projects into Workspace – Select root directory: • (point to the path where you cloned the project) – Finish! CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 21 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – There’s a nicer way to do it: • Window > Open Perspective > Other… > Git Repository Exploring • Or… use magic: CTRL+3 CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 22 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – There’s a nicer way to do it: • Window > Open Perspective > Other… > Git Repository Exploring • Add an existing Git repository CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 23 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – There’s a nicer way to do it: • Window > Open Perspective > Other… > Git Repository Exploring • Add an existing Git repository • Point to the location of your project 0 clone, and hit Search: CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 24 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – There’s a nicer way to do it: • Window > Open Perspective > Other… > Git Repository Exploring • Add an existing Git repository • Point to the location of your project 0 clone, and hit Search. Select your clone, and click ok. CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 25 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – There’s a nicer way to do it (cont’d): • Import project into your workspace CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 26 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Actually… there’s an even nicer way to do it: • Instead of using Git Bash, you could do everything from Eclipse! • File > Import… > Git > Projects from Git > Clone… • In the URI field, paste the SSH URI from BitBucket. • In the protocol field, select SSH CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 27 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Actually… there’s an even nicer way to do it: • Instead of using Git Bash, you could do everything from Eclipse! • File > Import… > Git > Projects from Git > Clone… • In the URI field, paste the SSH URI from BitBucket. • In the protocol field, select SSH CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 28 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Actually… there’s an even nicer way to do it: • Choose a Local Destination CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 29 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Actually… there’s an even nicer way to do it: • Choose a Local Destination • Select the Git repository to import CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 30 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Actually… there’s an even nicer way to do it: • Choose a Local Destination • Select the Git repository to import • Done! CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 31 Let’s get Project 0! • Let’s import Project 0 in Eclipse! – Note: Whenever you import a Git project to Eclipse via the Git UI, you get some additional Eclipse functionality, via the Team menu: CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 32 Let’s solve Project 0! • Taking a look at Project 0 (ParallelSum) – Run test – Implement the test method: ParallelAdderTest.testTotalSum() – Run test again… – Implement ParallelAdderWorker.run() – Run test again… – Implement ParallelAdderWorker.getPartialSum() – Run test again… CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 33 Let’s solve Project 0! • Submit your solution: – Run git add on your modified files. (in Git Bash) • Or use the Eclipse Team menu – Run git commit –m “…” – Run git push – See your changes online: https://bitbucket.org/<user>/project0-<dirId> CMSC433 Solving Project 0 (Getting started with BitBucket, Git and Eclipse) 34 QUESTIONS? THE END