Wiki

Clone wiki

inf225public / Using the SLE@UiB Team

I'm assuming you have a command-line Git available, otherwise all hope is lost.

If all else fails you can deliver your compulsory exercise solutions by zipping up the project and sending it by email. (File → Export → General → Archive File)

Important Note: Before you do anything, make sure that you have a backup copy of your work! And, make sure that the backup is marked as a backup, so you don't get confused later on as to what you're working on...

Somewhat Important Note: If the instructions don't work (either for your computer or for your brain), please complain!

Advanced Solution

  1. I'm assuming you have a clone of the inf225public repository. This is where you got the exercises from in the first place... I'm also assuming that you've done your development in this clone, and committed as you go. We'll now set it up so that you can push your committed solution to a place where we (and no one else) can read it. (Note: if you haven't yet cloned or forked inf225public, you can fork it directly into the SLE@UiB team (just select the team as 'Owner'). Please make sure to mark it as private, and use your own username in the repository name)

  2. First, check that you're a member of the SLE@UiB team. If not, send Anya an email with your Bitbucket user id (get one if you don't have one...), and she'll add you.

  3. Next, create a repository belonging to the team. (Press the big Create button at the top of the page, select sle-uib as the owner of the new repository, and put your name / UiB username as the repository name. Make sure to mark the new repository as private.) Make a note of the repository URL (you'll see it if you click on "I have an existing project to push up").

  4. Next, open a terminal and find your inf225public clone on your computer. If you have cloned inf225public directly, run the commands:

    git remote rename origin source
    git remote add origin <URL-TO-YOUR-SLE@UIB-REPO>
    

    The first command will rename your link to Anya's official repository to 'source'. The second will change where you normally push changes, so that your changes go to the repository you just created. Then, run:

    git push -u origin --all
    

    This will push everything into the new repository, and set it up so that subsequent pushes will also push to the same place. Go to the Bitbucket page of your repository, check the Source and Commits tabs, and make sure everything is there.

  5. The next time Anya does a bugfix or something in the inf225public repository, you can import all the changes into your own repo using the command:

    git pull source master
    

    If there were any changes, you might push them to your own Bitbucket repo by running:

    git push
    
  6. You are now a Git power-user! Congrats!

  7. Check the Bitbucket 101 page for more help.

  8. If you have already forked the public repo on Bitbucket, you can just change the owner to sle-uib (remember to update the 'origin' remote of you checked out clone at your computer), or give anyahelene and naimmd access to it. In either case, please set your repository to private.

Simple Solution

(Thanks to mockillo for this solution.)

The advanced solution is nice, because it allows you to update continuously with Anya's changes, and also have a private repository at Bitbucket – and there is no extra work to be done to submit your solutions.

But, if the above Git magic scares you, you can also do the following:

  1. Create a repository with your name in the sle-uib team (as in steps 2–3 above).

  2. Create a directory on your computer, and copy all the files you want to submit to it.

  3. Open a terminal, go to the directory and run the following commands:

    git init
    git remote add origin ssh://git@bitbucket.org/sle-uib/<your_repo_name>.git
    git add .
    git commit -m "<commit message, ie. initial commit etc etc>"
    git push --set-upstream origin master
    
  4. This will push everything in that directory to your new Bitbucket repository.

  5. If you would still like to be able to pull Anya's changes from the inf225public repository, you can do the following:

    git remote add source ssh://git@bitbucket.org/anyahelene/inf225public.git
    

    then run

    git pull source master
    

    whenever you want to update to Anya's lastest version.

  6. If you follow this recipe, make sure you don't get confused by having multiple repositories with different remotes on your computer. Either keep the new one separate, and copy files into it when you want to submit something; or remove your old projects from Eclipse, then import everything from the newly created repository. (File → Import → Git → Project from Git → Local → select directory containing repository → Import Existing Projects → select projects → Finish).

Updated