Lab 1 - git and bitbucket

  1. Make sure you have git installed. In Windows you can use Git Bash . Register an account on https://bitbucket.org/  and log in.
  2. Generate an app password (in case you do not have it yet): Profile -> Personal settings -> App passwords -> Create app password. Copy the password and keep it in some safe location. Give permissions to read/write repositories and projects.
  3. Create a bitbucket project for "Algorithms and Data Structures" course (in case you do not have it yet).
  4. Go to: https://bitbucket.org/itc_algorithms/ , open the project  Spring2024, and find a repository  hwa0 (klick on hwa0).
  5. Make a private server-side copy of hwa0. Open the menu of operations (three dots after the "Clone"-button) and choose "Fork this repository".  Use your personal workspace and project, also choose access level "Private repository". Perform "Fork repository".
  6. Go to the repository (https://bitbucket.org/john/hwa0, instead of john use your bitbucket username). Copy the repository url (upper-right of the webpage, use https not ssh): https://john@bitbucket.org/john/hwa0.git
  7. Open a terminal (or Gitbash) window:
cd Documents       # network folder in ITC Linux lab only
mkdir git             # root of all git repositories

Having the git root directory, switch to it:

cd git
git clone <bitbucket url copied, you can add app password here after the username separated by colon>   # local repository is created and linked to bitbucket
cd hwa0

Try to compile and run programs on command line (follow instructions on the repository homepage).
If you want to add the application password from the bitbucket now, include it in remote url after the username:
git remote set-url origin https://john:app-password-from-bitbucket@bitbucket.org/john/hwa0.git
  1. In IDE you must link src and test directories of the repository as "source root" and "test source root" directories. Also make the JUnit libraries in test directory available as project libraries.
  2. Try to edit the source and run the code in IDE. After saving your sources create a commit:
git commit -a -m 'summary of what you did'
  1. To upload the commit to the bitbucket:
git push -u origin master
  1. If the local repository is linked to bitbucket (we used "git clone" to do this, but you can always check the link with "git remote -v" command) you can download the recent version from the bitbucket using command:
git pull
  1. Read: http://rogerdudler.github.io/git-guide/, and certainly https://www.atlassian.com/git/tutorials


Jaanus Pöial