home—lects—exams—hws
D2L—breeze (snow day)
hw04-git
git usage
Due Mar.02 (Mon) 11:00; also see below
-
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 lect14-git-on-rucs—git: centralized workflow;
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).
Separately, you can also set:
git config --global push.default simple.
If you don't, it might prompt you to do that later.
(This is set to become the default behaviour soon, so setting it yourself
might not actually be needed.)
-
Find an email from bitbucket1
inviting you as a member of the itec325-2015spring-hw04 repository;
accept that invitation.
-
Locally, clone my (public) repository:
git clone https://yourUserName@bitbucket.org/ibarland/itec325-2015spring-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's not required (e.g. if your disc quota is low).
Alas, the version of git that is currently on rucs is old2;
it mostly works, except for cloning repos via https3, 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 using ssh instead of https.
However, this requires first generating a public/private key pair;
you'll have the private key stored locally (in ~/.ssh/id_dsa),
and you'll give bitbucket.org a copy of the public key
(http://bitbucket.org > Manage Account > SSH keys > Add).
Details can be found
here
and
an alternate method here.
-
Edit facts.txt,
along with some two-facts-and-a-lie about yourself.
(Note: this file will be public on my bitbucket account!)
-
Add a small picture to the project, using git add.
(of anything, but it should be polite, and you must have the right to copy it),
and update picts.php so that it includes a clickable thumbnail of that page.
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.
-
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, “.”.
-
Push your changes back to the public repository.
-
Note: in the following week, 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:
-
Make sure you clone (and later, push back to) the central repo,
bitbucket.org/ibarland/itec325-2015spring-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 clone the central repo to their own bitbucket account,
creating
bitbucket.org/theirUserName/itec325-2015spring-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 class4 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.
(I believe both of these errors stem from running commands from bitbucket's web page,
and/or from a gui interface,
and the user not realizing that those commands not actually being what this hw asking you to do.)
Part II
For 5pts extra-credit (due 2015.May.07 (Thu) 17:00):
Go back to your entry in facts.txt, and:
-
on the line after each of your
three facts, add a sentence saying either “False” or “True”
(and any explanation you might care to provide).
-
on the line before your three facts, add a line
“[previous update by username]”,
where username is the name of the most recent other
person
who made the previous change to the file.
(For example, since I just updated my own facts, the first 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!
1Check your spambox. If you can't find it,
you can go to your bitbucket account page, and have the invitation re-sent.
↩
2on
rucs, git --version gives 1.5.4.3, as of 2014-Mar-12; we want
a version ≥ 1.8. ↩
3
The error message in this case is:
Initialized empty Git repository in …/itec325-2015spring-hw04/.git/
Cannot get remote repository information.
Perhaps git-update-server-info needs to be run there?
|
↩4
And to sustain the confusion: you might see a classmate's old work in your parallel
bitbucket copy of the repo, just because it was already present at the moment you made your
initial clone.
↩
home—lects—exams—hws
D2L—breeze (snow day)