PowerShell/docs/git/basics.md

83 lines
2.4 KiB
Markdown
Raw Normal View History

2019-03-05 21:45:46 +01:00
# Getting started with Git
We are using Git version 2.9.0, but any recent version should be good.
2016-07-15 18:19:47 +02:00
It's recommended to learn the `git` command-line tool for full
2016-04-07 22:47:07 +02:00
cross-platform experience and a deeper understanding of Git itself.
2019-03-05 21:45:46 +01:00
## Install
2019-03-05 21:45:46 +01:00
### Windows
Install [Git for Windows][].
2016-07-15 18:19:47 +02:00
During the installation process, choose these recommended settings:
* Use Git from the Windows Command Prompt
* Use OpenSSH
* Checkout Windows-style, commit Unix-style line endings
* Use Windows' default console window
* Enable file system caching
2016-03-31 08:10:31 +02:00
[Git for Windows]: https://git-scm.com/download/win
2019-03-05 21:45:46 +01:00
### Linux
Install by using the package manager on your system.
A list of all the package managers and commands can be found [here][linux-git-dl].
2019-03-05 21:45:46 +01:00
### Interactive tutorials
There are (too) many Git tutorials on the internet. Here we post
references to our favorites.
2016-07-15 18:19:47 +02:00
#### Hello World
If you're new to Git, learn the following commands: `checkout`, `branch`,
`pull`, `push`, `merge`.
Use GitHub's [Hello World][] to learn how to create a feature branch, commit
changes, and issue a pull request.
2016-07-15 18:19:47 +02:00
[Hello World]: https://guides.github.com/activities/hello-world/
2016-07-15 18:19:47 +02:00
#### Katacoda
2016-07-15 18:19:47 +02:00
Learn basic Git scenarios in the browser with interactive labs.
[Git lessons on katacoda](https://www.katacoda.com/courses/git/).
#### Githug
2016-03-31 08:10:31 +02:00
[Githug](https://github.com/Gazler/githug) is a great gamified way to
learn Git in couple hours. After finishing 50+ real-world scenarios
you will have a pretty good idea about what and when you can do with
Git.
2019-03-05 21:45:46 +01:00
## Authentication
2016-06-24 02:11:56 +02:00
2019-03-05 21:45:46 +01:00
### Windows
2016-06-24 02:11:56 +02:00
2016-07-15 18:19:47 +02:00
On Windows, the best way to use Git securely is [Git Credential Manager for Windows][manager].
It's included in the official Git installer for Windows.
2016-07-12 21:53:15 +02:00
#### Linux and macOS
2016-07-12 21:53:15 +02:00
2016-06-24 02:11:56 +02:00
If you do not have a preferred method of authentication, enable the storage
credential helper, which will cache your credentials in plaintext on your
system, so use a [token][].
```sh
git config --global credential.helper store
```
2016-07-15 18:19:47 +02:00
Alternatively, you can use [SSH key][].
In this case, you may want to use git-ssh even for HTTPS Git URLs.
2016-07-12 21:53:15 +02:00
2019-03-05 21:45:46 +01:00
```none
2016-07-12 21:53:15 +02:00
git config --global url.git@github.com:.insteadOf https://github.com/
```
2016-07-15 18:19:47 +02:00
[SSH key]: https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/#generating-a-new-ssh-key
2016-06-24 02:11:56 +02:00
[token]: https://help.github.com/articles/creating-an-access-token-for-command-line-use/
[manager]: https://github.com/Microsoft/Git-Credential-Manager-for-Windows
[linux-git-dl]: https://git-scm.com/download/linux