Assignment Submission Instructions - Department of Computer ...

11 downloads 74 Views 92KB Size Report
Only if you haven't used GitLab before: 4. – 5. Setting up credentials for using remote repository. Necessary for everyone: 6. – 7. Synchronizing local and remote ...
Instructions For Submitting Coursework T-110.5140 Network Application Frameworks Spring 2013

Foreword To encourage you to using version control tools in project work, we are using Git as an assignment submission system on this course. These instructions will not tell how to use Git for its primary purpose, which is not assignment submission but version control. Rather they just go through the steps you need to take to fulfill the requirements of the assignment submission process on the course. Please do not make a mistake and think that Git would be just a submission system, which it is not.

Prerequisites You need to have: Niksula account installation of Git In addition, we recommend you to install an additional application that provides a graphical user interface for Git. Niksula Account Niksula is a domain of workstations for the students of computer science and engineering at Aalto. Authentication of the project management system that is handling the submission repositories is bound to the niksula user accounts. To be able to submit your work on the course, you need to have a niksula user account. If you don’t have one, please send an email to the course staff as soon as possible. You should mention your Aalto account username. You may test out your credentials at https://git.niksula.hut.fi. Please note that for some people the account is bound to Aalto credentials. Git Git is an open-source version control system with a command-line interface. The newest version and instructions for installation are available at http://git-scm.com. The process depends on your operating system. Linux: use package manager Mac OS X: choose one from the options 1. download and install 2. install Apple developer command-line tools Windows: download and install More help available at https://help.github.com/articles/set-up-git. Git GUI While not necessary, a graphical user interface may make operating Git easier. There are several options available, both commercial and free. Some of them are stand-alone and some are integrations to IDEs. Please note that we do not provide support for using these additional interfaces. Linux: git-gui, gitk Mac OS X: SourceTree, Tower Windows: TortoiseGit

Required Steps for Submission Submission in the context of the course means pushing the work that you have done under version control locally to the remote repository provided by the course. The following steps can be split to three phases. Only if you haven’t yet used Git with your assignment: 0. – 3. Initialization and first commit in your local repository Only if you haven’t used GitLab before: 4. – 5. Setting up credentials for using remote repository Necessary for everyone: 6. – 7. Synchronizing local and remote repository The commands are to be run in shell (terminal). For Windows, use git-bash bundled with the Git installation package. Please note that the paths in the following code clips are examples that you are supposed to substitute with your own corresponding paths.

0. Configure Your Environment You need to tell Git your name and email address to make them appear correctly in the commit messages. The following commands do this globally, i.e. set default for your user account on the computer you are working at.

# set default for the name git config --global user.name "Your name" # set default for the email git config --global user.email "[email protected]" At least on Aalto computers, you will also want to set up these parameters: # use your favourite text editor for commit messages etc. git config --global core.editor "nano" # configure less to work properly with Git git config --global core.pager "less -F -X -R" # colorize output git config --global color.ui true

1. Initialize Your Local Repository # 1. navigate to your project directory cd studies/naf # 2. initialize git repository into the directory git init .

2. Select The Files To Be Submitted Please do not add any binary files, unless you have a really good justification for it. We will not check your compiled work. Instead, we use your source code when needed. Please refer to General Guidelines for Assignments for more information. # 0. if you are not in your project directory, navigate there cd studies/naf # 1. see what paths Git does not know about git status # 2. add necessary paths git add assignment_1/doc assignment_1/src # 3. check the files to be committed git status # 4. if you added a file that you did not mean to, remove it git rm --cached assignment_1/src/MyApplication.class

3. Make A Commit A commit is an action of creating a set of changes that will be added to version control. While we encourage you to track the evolution of your assignment work and make commits when appropriate, we only require a single commit per assignment. # 1. check your changes one more time git status ### the next one may open up a text viewer; try exiting by 'q' git diff --cached # 2. make a commit (write a decent commit message such as below!) git commit -m 'add assignment 1' # 3. check that everything went well git log -1

4. Create And Load An SSH key

GitLab uses an SSH connection as a communication medium and SSH keys for authentication. If you already one and want to use that, you may skip this step. SSH keys are a form of asymmetric encryption, i.e. a pair of private and public key. You should keep private key to yourself (and protect it), whereas you may give your public key anywhere without compromising security. Please refer to instructions at https://help.github.com/articles/generating-ssh-keys. If you want to use a path that is different from the default (for multiple keys), please remember that you need to use SSH agent or tell git to explicitly use that key.

5. Add Your Key To GitLab The procedure for adding the key to GitLab is essentially the same as with GitHub. For more specific instructions, please refer to the link above. 1. Go to https://git.niksula.hut.fi/profile 2. Add your public key 3. Test out that your key works:

$ ssh -T [email protected] hello _niksula_hut_fi_, R W

t-110-5140/group

6. Push Your Work To The Remote Repository In the example below, please remember to change the URL to correspond your group number (remove angle brackets). # 0. if you are not in your project directory, navigate there cd studies/naf # 1. check log to see what you are pushing git log master # 2. push the master branch from your local repository to the remote one git push [email protected]:t-110-5140/group master

7. See The Results Go to GitLab to see the results. If there is something wrong, please confirm that you have completed the previous steps correctly. Direct link: https://git.niksula.hut.fi/t-110-5140/group

Overwriting previous changes If you get an error like below, there is already something in the remote repository. ! [rejected] master -> master (non-fast forward) error: failed to push some refs To resolve the issue, please go to GitLab, navigate to the project and go the Files. If the files you see there are not the ones you are willing to submit, then try to push again with a flag -f. This will overwrite the history in the remote repository. Direct link: https://git.niksula.hut.fi/t-110-5140/group/tree/master While we allow you to modify the version history for the first assignment, we may change the policy later on. Nevertheless, the version available at the deadline will be considered as your submission.

How To Proceed To The Next Assignments As there is only one submission repository per group for the whole course, you will need to commit your next submission changesets onto the first one. This will not overwrite the first assignment, however, as the submissions are requested to be put into separate directories. Follow the sequence below at least for once to make a successful submission. 1. 2. 3. 4.

use existing local repository or clone the remote to be your one put your work to the directory corresponding to the assignment in the local repository add and commit your work as with the first assignment push your committed work

Please remember that you may use the submission repository and project at GitLab for your work as well. Once again, you don’t have to do this, but we are ready to bet this will save a lot of your effort.

Making Push Command Easier You may tell Git that there is a certain remote repository that you want to use for pushing or pulling changes. Configuration works as follows. # configure: git remote add # push: git push # pull: git pull # example ### origin is a naming convention for main remote repository git remote add origin https://git.niksula.hut.fi/t-110-5140/group ### -u = --set-upstream = no need to specify origin and master again git push -u origin master ### following pushes/pulls: git remembers git push

Problems? If you have encountered problems with your submission, please contact the course staff. Please report, what you have done and what errors you got. The sooner, the better. Email: [email protected]

More Help? For further reference, see Git documentation at http://git-scm.com/doc. If you need some more advice, you may also contact the course staff.