Getting Started
In the real world, your first step is to create or clone a repository that has been shared with you -- like you just did.
My userid is "sml3", so my bitbucket repository may be found on the web at https://bitbucket.org/sml3/cse216-fa24-tutorials/src/main/. If you click that link, you won't have permission to view the page, but if you change the the username (sml3) to yours, you should see your page as we did before:
The README.md
file is written in a language called "markdown".
Earlier in this tutorial sequence, you may have learned that Markdown is a lightweight language that can easily be translated to HTML.
Bitbucket is translating our README.md
file into HTML and embedding it into the main page for our repository.
Pretty cool!
While we can edit files through the bitbucket web frontend interface, it is very convenient to do our work "locally" and push our changes remotely when ready.
To get it cloned locally, I should go to the folder that I want to be the parent of the folder where I will do my work, and then type git clone git@bitbucket.org:sml3/cse216-fa24-tutorials.git tutorials
.
To get this link easily, recall that the previous section on "Cloning a repo" shows you how.
Here's an example, using Git Bash for Windows:
Let's break down what just happened:
-
I typed
pwd
to show the path of the "present working directory" of my terminal -
I typed
cd /c/devel/cse216/fall2024
to change to an existing subfolder calledfall2024
on my "c" drive (nested under thedevel
andcse216
folders). A couple important notes on naming of folders- You may wish to
cd Desktop
orcd OneDrive/Desktop
to go to your Desktop folder.- However, some have found that the auto-backup feature of OneDrive (on Windows) does not "play nicely" with git. This is because with git we can frequently be changing files faster than the backup system can handle, which can cause odd read/write errors to your files. YMMV
- Spaces generally cause problems to command-line paths.
- Using tab from the command line in order to "autocomplete" a word can help "escape" a filename containing spaces automatically for you.
- In general, when doing command-line based work, it can be easier to use names that do not include spaces.
- You may wish to
-
I used the
git clone
command to get a copy of the repository where I'm supposed to do my work:git clone git@bitbucket.org:sml3/cse216-fa24-tutorials.git tutorials
- we are invoking the program
git
and asking it to run itsclone
behavior - the git
clone
command must have the source (or "remote") location of the repo to clone as the next argument, in this casegit@bitbucket.org:sml3/cse216-fa24-tutorials.git
- here we are using the ssh protocol (
git@bitbucket.org
, wheregit
is the user andbitbucket.org
is the host name); if you're having ssh trouble, do a clone with theHTTPS
approach described earlier - after the protocol is the path of the remote repo (
sml3/cse216-fa24-tutorials.git
)
- here we are using the ssh protocol (
- after the source location, we can optionally provide the name of the folder into which the clone should be made (in this case, we simply named it
tutorials
)
- we are invoking the program
-
I used the
cd
command again, to move into the folder I just created.- by default, the folder got named the same as the repo -- in this case
tutorials
- you could have cloned into a non-default name by providing another argument to the clone command, such as:
git clone git@bitbucket.org:sml3/tutorials.git myFolderName
- by default, the folder got named the same as the repo -- in this case
-
I used the
ls
command to see what files were in the folder. -
I used
ls -a
to see all files, even the hidden ones (that start with a.
).
Next, let's open this file in Visual Studio Code.
- From the terminal, type
code . &
to open up the current folder (if prompted, do "trust" the authors).- if you get a complaint that
code
is not found, then the program is not on your terminalspath
. - the first argument to the program code is
.
, which represents the current folder - the final argument is
&
which is meant to launch the program and return control to the terminal (on many shells, the&
is no longer required for thecode
program)
- if you get a complaint that
- Then on the left, choose
README.md
. - Then on the right, click the button to "Open Preview to the Side".
You should see something like this:
The "rendered" markdown on the web usually looks close to the preview in VSCode, but not always.
It can be handy to have a quick "cheatsheet" on markdown syntax -- you may wish to visit https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet.