Git course 2021
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Help
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

Your note will be visible on your profile and discoverable by anyone.
Your note is now live.
This note is visible on your profile and discoverable online.
Everyone on the web can find and read all notes of this public team.
See published notes
Unpublish note
Please check the box to agree to the Community Guidelines.
View profile
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
--- title: "Lecture 0: Setup" tags: Lecture, Birgitte, day 1 description: "Git installation etc" --- Introduction to Git --- Fall 2021 # Lecture 0: Setup <!-- .slide: data-background="#ffffff" --> <!-- Lecture material made by Birgitte Brydsö for the version of the course that was given in fall 2020. Lecture was first given by Birgitte Brydsö in fall 2020. Minor modifications done for the fall 2021 version of the course. --> ![TOC](https://www.hpc2n.umu.se/sites/default/files/umu-logo-left-se.png =250x) ![](https://www.hpc2n.umu.se/sites/default/files/hpc2n-logo-text5.png =250x) ![](https://www.hpc2n.umu.se/sites/default/files/images/SNIC_logo_autocrop.png =250x) <small>Slides: https://hackmd.io/@hpc2n-git-2021/L0-setup#/</small> --- ## Installing and setting up Git <!-- .slide: style="font-size: 30px;" --> 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: * git-scm (https://git-scm.com) comes with a basic GUI * Git Kraken (https://www.gitkraken.com/) * Github Desktop (https://desktop.github.com/) Windows and macOS only * Sourcetree (https://www.sourcetreeapp.com/) Windows and macOS only * TortoiseGit (https://tortoisegit.org/) Windows only --- ### Installing and setting up Git - continued <!-- .slide: style="font-size: 38px;" --> * Install Git, if you have not already * Create a repository with `git init` * Set your name and email with `git config` (local, global, system) * Test by creating a file * Then adding the file with `git add` * Then commiting the file with `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 <!-- .slide: style="font-size: 32px;" --> * Go to the Git-scm website (https://git-scm.com/downloads) and click "Windows" to download the Windows version. It will automatically start download of the .exe file. * The downloaded file can be installed by double-clicking and choosing "Run". * Click "Yes" to let it be installed and then "Next" to accept the GNU GPL. * The default options you are presented with should work, and we recommend using those. * NOTE: when it comes to choosing the default editor, we recommend using Vim, unless you have a preferred editor. --- ### Git install - macOS <!-- .slide: style="font-size: 34px;" --> 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. * SourceForge: https://sourceforge.net/projects/git-osx-installer/files/ * Git-scm.com: https://git-scm.com/downloads * If you have Homebrew: `brew install git` --- ### Git install - Linux <!-- .slide: style="font-size: 38px;" --> Installing Git on Linux depends on which distro you are running. * `sudo apt-get install git` (Ubuntu, Debian) * `sudo dnf install git` (RHEL, CentOS) * https://git-scm.com/download/linux (other) --- ## Configure git <!-- .slide: style="font-size: 38px;" --> First check that you have git installed: ```bash $ git --version ``` Now configure git with * `git config (local, global, system)` You should at least set your global name and email (just once): ```bash $ git config --global user.name "Your Name" $ git config --global user.email "yourname@example.com" ``` --- ## Configure git - continued <!-- .slide: style="font-size: 34px;" --> Setting the editor (once) is also a good idea: ```bash $ git config --global core.editor <editor> ``` Choices for editor could be: * nano * vim * emacs --- ## Test your Git installation <!-- .slide: style="font-size: 32px;" --> Create an example folder and change to that, then create a file test.txt. On Linux you would do this: ```bash $ mkdir <mydir> $ cd <mydir> $ touch test.txt ``` Now initialize a repository and stage the new file: ```bash $ git init Initialized empty Git repository in /home/bbrydsoe/test-git/.git/ $ git add test.txt ``` Now *commit* the change. The editor which you configured earlier should open. Add an example commit message: ```bash $ git commit test.txt [master (root-commit) ff8b6f6] Test of git 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test.txt ``` --- ## Test your Git installation - continued <!-- .slide: style="font-size: 32px;" --> Now let us look at the log: ```bash $ git log commit ff8b6f699d98c72d5cffc64d65a1c618b976b45a (HEAD -> master) Author: Birgitte Brydsö <bbrydsoe@cs.umu.se> Date: Thu Sep 17 13:53:59 2020 +0200 Test of git ``` 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 <!-- .slide: style="font-size: 32px;" --> 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) * Please go to the terminal window where you have downloaded and set up Git. * Change the directory to wherever you wish to have the course material. * *Do one of*: - 1. Download the zipfile and unzip - 2. `git clone https://github.com/hpc2n/course-intro-git.git` --- ## Web based Git repositories <!-- .slide: style="font-size: 32px;" --> There are several web based Git repository. Some of the more popular ones are: * GitHub * GitLab * Bitbucket We are going to use GitHub for the part of the hands-on where you will be working together in groups. Please go to * https://github.com/ and sign up for an account. --- <!-- ## GitHub CLI GitHub also has a command line interface that you can use if you want to. It is available for Windows, macOS, and Linux. You can use it if you prefer to do your workflow through a terminal, and you can call the GitHub API to script various actions as well as set a custom alias for any command. More information and download here: https://github.blog/2020-09-17-github-cli-1-0-is-now-available/ --- --> ## Editor, Linux <!-- .slide: style="font-size: 30px;" --> Vim * You may need to install it first. (`sudo apt-get install vim`) * Start with `vim <filename>` where the file does not need to exist before. You open a new file for editing. * Type `i` to enter 'insert' mode to be able to write in the editor. * Use `ESC` to go to 'command' mode and then `:wq` to save and exit the editor. * When you are in 'command' mode, typing `dd` will delete the whole line your cursor is on. Nano * Start with `nano <filename>` where the file does not need to exist before. You open a new file for editing. * Ctrl-x will exit the editor, asking first if you want to save it.

Import from clipboard

Paste your markdown or webpage here...

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template has been removed or transferred.
Upgrade
All
  • All
  • Team
No template.

Create a template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

Slide Example

API Docs

Edit in VSCode

Install browser extension

Contacts

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

Note content is identical to the latest version.
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

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.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully