This tutorial contains instructions on how to clone a repo, edit a file, and commit/push changes all from the command line.
Before starting the activity, make sure you have a fork of the repository on your Github account.
To log into the ieng6 machine remotely I typed ssh cs15lwi23acc@ieng6.ucsd.edu <Enter>
into the terminal.
You may want to copy and paste the account name if you find that it is faster or easier for you.
I navigated back to the repo page and pressed the copy button (the two layered squares) next to the SSH link in order to copy it to my clipboard.
Then, back in the terminal, I typed git clone <Ctrl>V <Enter>
to clone the link that I pasted in.
Before being able to compile and run the files, I made sure to cd lab7
into the newly added directory.
I visited the CSE 15L website, highlighted the first command in yellow, and pressed <Ctrl>C
to copy it.
Then I went back to the terminal and pressed <Ctrl>V <Enter>
to paste and run it.
Similarly, I went back to the website, highlighted the second command in yellow, and pressed <Ctrl>C
to copy it.
I went back to the terminal and typed <Ctrl>V ListExamplesTests <Enter>
to paste and run it specifically using the ListExamplesTests file.
I typed nano ListExamples <Enter>
to open the bugged file in the nano editor. After entering the nano editor, I held down <down>
for 42 lines and held down <right>
to navigate to the right by 12 characters. I used <backspace>
to delete the “1” in “index1” and typed 2
in order to fix the bug.
To save the file, I pressed <Ctrl>O <Enter>
and then exited the editor with <Ctrl>X
.
Since I already ran the two commands to compile and run the files earlier, I typed <Ctrl>R javac <Enter>
to find the command to compile the files. Then I used <Ctrl>R java <Space><Enter>
to find the command to run the tester file. Adding the space during the second command helps the computer differentiate between java
and javac
.
This time, it passes both tests.
To commit I typed git commit -am "edited ListExamples" <Enter>
to add the newly edited file and commit the changes with a descriptive message.
To then push the commit I typed git push <Enter>
.