or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing
xxxxxxxxxx
Introduction to Git –- Fall 2021
Lecture 0: Setup
Slides: https://hackmd.io/@hpc2n-git-2021/L0-setup#/
Installing and setting up Git
We will use Git from the command line in this course. This is how you will use it on HPC2N's systems, and it will be easier to understand what is going on while you are learning to use Git.
Graphical tools exists for Git, see below list for a few. All entries on the list are free and unless otherwise mentioned for Windows, macOS, and Linux:
Installing and setting up Git - continued
git init
git config
(local, global, system)git add
git commit
When this is done, you will clone the course materials.
NOTE: if you have a problem and want to use Kebnekaise for this part, we have documentation for you.
Git install - Windows
Git install - macOS
If you have installed XCode (or its Command Line Tools), Git may already be installed. To find out, open a terminal and enter
git --version
.If Git is not installed, you have several installation options. Apple maintains their own fork of Git, but it is usually a few versions behind, so we do not recommend installing that.
brew install git
Git install - Linux
Installing Git on Linux depends on which distro you are running.
sudo apt-get install git
(Ubuntu, Debian)sudo dnf install git
(RHEL, CentOS)Configure git
First check that you have git installed:
Now configure git with
git config (local, global, system)
You should at least set your global name and email (just once):
Configure git - continued
Setting the editor (once) is also a good idea:
Choices for editor could be:
Test your Git installation
Create an example folder and change to that, then create a file test.txt. On Linux you would do this:
Now initialize a repository and stage the new file:
Now commit the change. The editor which you configured earlier should open. Add an example commit message:
Test your Git installation - continued
Now let us look at the log:
When you do
git log
, you should see something like the above, but with name, email, and commit message different. If that is the case, your Git should be configured correctly.Download the course materials
For the individual hands-on part of the course, we have created some course materials which you will download from the course GitHub: https://github.com/hpc2n/course-intro-git (normally you click the green "Code" button to get the link to clone or download)
git clone https://github.com/hpc2n/course-intro-git.git
Web based Git repositories
There are several web based Git repository. Some of the more popular ones are:
We are going to use GitHub for the part of the hands-on where you will be working together in groups.
Please go to
and sign up for an account.
Editor, Linux
Vim
sudo apt-get install vim
)vim <filename>
where the file does not need to exist before. You open a new file for editing.i
to enter 'insert' mode to be able to write in the editor.ESC
to go to 'command' mode and then:wq
to save and exit the editor.dd
will delete the whole line your cursor is on.Nano
nano <filename>
where the file does not need to exist before. You open a new file for editing.