home—lects—hws
D2L—breeze (snow day)
git usage
hw04
Due Feb.28 (Thu) at start of class; also see part II, below
This assignment gives the class experience in using git, and updating a shared repository.
For this assignment,
you must use the command-line interface to git,
rather than a gui interface (e.g. via bitbucket.org's web interface).
- Create a bitbucket.org account.
You can use whatever name you like, but you must make sure that you
your bitbucket account is also associated with your RU email (@radford.edu).
- Locally (on your machine, or on rucs), be sure to configure your name and email,
as per git;
in particular
git config --global user.email yourUserName@radford.edu
(so that when your local computer makes requests to bitbucket.com,
it knows whose
password it should be asking for).
- Find an email from bitbucket
inviting you as a member of the ibarland/itec325-2019spring-hw04 repository;
accept that invitation
(sent 2019-Feb-23 around 18:05).
- Locally, clone my (public) repository:
“git clone https://yourUserName@bitbucket.org/ibarland/itec325-2019spring-hw04.git”.
I suggest doing this somewhere within your H: drive’s dynamic_php/…
(mounting your H: drive if on your laptop),
so you can view the results via the web.
However, that isn’t required (e.g. if your disc quota is low).
Alas, the version of git that is currently on rucs is old;
it mostly works, except for cloning repos via https, which is
the one step we need to get started!
- The easiest workaround, if you have your own machine w/ administrator privileges,
is to download/install git there.
- You can clone the repo on rucs via ssh
by
git clone git@bitbucket.org:ibarland/itec325-2019spring-hw04.
You just need to generate a public/private key pair first (by running ssh-keygen).
You'll have the private key stored locally (in ~/.ssh/id_rsa),
and you'll give bitbucket.org a copy of the public key
(http://bitbucket.org » your avatar » Bitbucket Settings » SSH keys » Add).
The project itself has a couple files re-going-over these same instructions for
creating ssh keys
and
adding ssh keys to bitbucket.
Debugging:
You can test whether your public-key-on-bitbucket is working
independently of git
by testing ssh -T hg@bitbucket.org (yes, include the “hg”
literally);
if it shows “logged in as yourUserName” then your public-key is all set.
If it shows “Permission denied (publickey)” (or something else), then you
need to double-check that the private-key on your machine corresponds to the
public-key
you have listed in your bitbucket profile » preferences.
- Edit facts.txt,
along with some two-facts-and-a-lie about yourself.
(Note: this file will be public on my bitbucket account!)
Follow the existing format (each fact starts with username, colon, etc.).
As always, grammar/spelling counts.
Add a small picture to the project, using git add.
Update picts.php so that it includes a clickable thumbnail of that page.
(A picture of anything polite, and you must have the right to copy it.)
Make sure your picts.php works correctly!
- If you cloned this repo somewhere into your H: drive’s dynamic_php already,
then you can view it as expected.
- If you didn't do that before, you can push your changes to the canonical repo
(see next step)
and then
cd to your dynamic_php/…
and then clone another copy, and view it.
- If you don't want to place this .php file
in your dynamic_php/… to
view it, you can just run php picts.php >! picts.html,
and then open that HTML file from your browser.
- Note that the provided repo already includes .gitignore mentionig
facts.html,
so you can generate that filename and it won't be added to the repository
(which is the desired behavior, since it's a file generated via a program).
- Commit your changes to your local repo, with a short (≤ 1 sentence) message
saying what you did.
You can use “git commit .”, which will cause an editor to launch
for you to write the commit-message in. Alternately,
you can run
“git status .” (to be sure you recall all the files you changed),
followed by
“git commit -m "your message" .”
to commit all changes to the current directory, ..
Warning: If you commit and get a warning about a conflict, be sure to resolve it before (re)committing.
You'll get no credit if you commit something which includes the conflict.
- Push your changes back to the public repository.
Hint: If you get an error about “not authorized” for writing to the repository,
it may be because you didn't
respond to bitbucket.org's invitation link
in step 3 above.
(The repo is world-readable — so just because you could clone it doesn't mean you
also have write permission.)
If the invitation-link has expired, let the prof know, and they can re-send the invitation.
- Note: in the following days, I'll have each person make a change to the file,
and then I'll be asking a D2L question based on your classmates' updated version.
Common mistakes:
- Using bitbucket’s GUI buttons, rather than command-line tools.
The buttons don't make it entirely clear what you're doing, and
using them often leads to the problems below.
Make sure you clone (and later, push back to) the central repo,
bitbucket.org/ibarland/itec325-2019spring-hw04.git.
(The yourUserName@ in the clone request indicates
which user is accessing the repo; the ibarland is the owner
of the repo. Don't confuse/swap the two.)
In particular, some people (using the GUI interface) clone the central repo
to their own bitbucket account, creating
bitbucket.org/theirUserName/itec325-2019spring-hw04.git,
and then clone that one to their laptop.
Later, when they push from their laptop back, they're pushing to their duplicated
version hosted on bitbucket,
and not the one me nor anybody else in the class is using.
Be sure to push to the repo — not “issue a pull request”.
That latter is an email sent to me (the repo owner), letting me review the changes before
I pull them in. It’s intended for (say) the public to contribute to open-source projects
but making sure a project-member reviews the changes before adding them to the repo.
Since you all have write-permission on the project,
there is no need to issue pull-requests — you should just push directly
to the repo.
Part II
due 2019.Mar.05 (Tue.) at start of class;
only complete this after the the part I deadline above.
(5pts)
Go back to your entry in facts.txt, and:
- after each of your three statements,
add either “False” or “True”
(and any explanation you might care to provide);
- Following your three statements and comments,
add a line
“[previous update by username]”,
where username is the
person who made the most previous change to the file (besides you).
(For example, if just updated my own facts, the next student
to complete this will have “[previous update by ibarland]”.)
hint: git log
You must, of course, push your changes back to the central repo,
or else I won't see them!
home—lects—hws
D2L—breeze (snow day)
This page licensed CC-BY 4.0 Ian Barland Page last generated | Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |
|