Skip to content
Snippets Groups Projects

Finished first version of git-remote content.

Merged Mark HOEBEKE requested to merge git-remote into main
15 files
+ 12
39
Compare changes
  • Side-by-side
  • Inline
Files
15
+ 3
18
@@ -8,13 +8,6 @@ This is also handy when you work on several different machines (your personal la
A more advanced usage is to work on several local copies of a remote repository simultaneously. Ex.: You are working on a new feature of your program (or a new chapter of your book), but you need to fix a bug in the current release of the same program (or you want to fix typos and other minor mistakes in another chapter). Git makes it easy to have two (or any number of) *distinct* copies of the same repository on your machine in completely separate folders, and allows you to make modifications in isolation before propagating your work back to the same remote repository.
## Git from the command line interface (CLI)
From now on, we will mostly use the Git CLI interface, available for Linux, MacOS and Windows. These operating systems also provide graphical user interfaces allowing to use Git without typing actual commands, but we have no time in this session to cover these.
On the CLI, all Git commands start with `git` followed by a keyword matching a git operation (`clone`, `add` , `rm`, `branch`) and a set of arguments and options specific to each operation.
## Cloning a Repository
Copying a remote repository is called *cloning*. In order to be able to clone a repository, you need its address (URL). For non-public repositories you may also need credentials (login/password, SSH key or other).
@@ -23,7 +16,8 @@ The actual URL(s) for a GitLab hosted project can be found by clicking the `Clon
![clone_button.png](./media/clone_button.png)
### Cloning using HTTPS
## Cloning using HTTPS
The complete command to clone a repository from GitLab using HTTPS looks like:
@@ -41,7 +35,7 @@ The command may ask you for your GitLab username and your password.
- The benefit of using HTTPS is that no further setup is needed on your workstation.
- The drawback is that unless you use advanced (and insecure) git commands to store your username and password, you will need to enter them every time you communicate with the remote repository.
### Cloning using SSH
## Cloning using SSH
Using SSH to interact with the repository required you to copy an SSH key file to GitLab. If you have no such key, you will have to generate it.
@@ -66,12 +60,3 @@ This contents has to be copied to the GitLab SSH Key management page, accessible
The SSH private key must be present in the correct location on each machine (laptop, workstation) that will be used to access the GitLab repository. It is recommended to generate a key pair on each machine and to add each public key to GitLab. It avoids having multiple copies of a private key, and also allows to track which machine was used to access the repository.
Loading