This section provides resources to help you start with GitLab by focusing on basic functionality.
This section provides resources to help you start working with GitLab and Git by focusing
on the basic features that you will need to use.
This documentation is split into the following groups:
-[GitLab-specific functionality](#gitlab-basics), for basic GitLab features.
-[General Git functionality](#git-basics), for working with Git in conjunction with GitLab.
-[General Git functionality](#working-with-git-from-the-command-line), for working
with Git in conjunction with GitLab.
## GitLab basics
...
...
@@ -17,22 +20,26 @@ The following are guides to basic GitLab functionality:
-[Create and add your SSH public key](create-your-ssh-keys.md), for enabling Git over SSH.
-[Create a project](create-project.md), to start using GitLab.
-[Create a group](../user/group/index.md#create-a-new-group), to combine and administer projects together.
-[Create a group](../user/group/index.md#create-a-new-group), to combine and administer
projects together.
-[Create a branch](create-branch.md), to make changes to files stored in a project's repository.
-[Fork a project](fork-project.md), to duplicate projects so they can be worked on in parallel.
-[Add a file](add-file.md), to add new files to a project's repository.
-[Add an image](add-image.md), to add new images to a project's repository.
-[Create an issue](../user/project/issues/managing_issues.md#create-a-new-issue), to start collaborating within a project.
-[Create a merge request](add-merge-request.md), to request changes made in a branch be merged into a project's repository.
- See how these features come together in the [GitLab Flow introduction video](https://youtu.be/InKNIvky2KE) and [GitLab Flow page](../workflow/gitlab_flow.md).
-[Create an issue](../user/project/issues/managing_issues.md#create-a-new-issue),
to start collaborating within a project.
-[Create a merge request](add-merge-request.md), to request changes made in a branch
be merged into a project's repository.
- See how these features come together in the [GitLab Flow introduction video](https://youtu.be/InKNIvky2KE)
and [GitLab Flow page](../workflow/gitlab_flow.md).
## Git basics
## Working with Git from the command line
If you're familiar with Git on the command line, you can interact with your GitLab projects just as you would with any other Git repository.
If you're familiar with Git on the command line, you can interact with your GitLab
projects just as you would with any other Git repository.
These resources will help get further acclimated to working on the command line.
-[Start using Git on the command line](start-using-git.md), for some simple Git commands.
-[Command line basics](command-line-commands.md), to create and edit files using the command line.
More Git resources are available at GitLab's [Git documentation](../topics/git/index.md).
More Git resources are available in GitLab's [Git documentation](../topics/git/index.md).
In Git, when you copy a project you say you "clone" it. To work on a git project locally (from your own computer), you will need to clone it. To do this, sign in to GitLab.
When you are on your Dashboard, click on the project that you'd like to clone.
To work in the project, you can copy a link to the Git repository through a SSH
or a HTTPS protocol. SSH is easier to use after it's been
[set up](create-your-ssh-keys.md). While you are at the **Project** tab, select
HTTPS or SSH from the dropdown menu and copy the link using the _Copy URL to clipboard_
button (you'll have to paste it on your shell in the next step).
![Copy the HTTPS or SSH](img/project_clone_url.png)
## Working with project files on the command line
This section has examples of some basic shell commands that you might find useful. For more information, search the web for _bash commands_.
Alternatively, you can edit files using your choice of editor (IDE) or the GitLab user interface.
### Clone your project
Go to your computer's shell and type the following command with your SSH or HTTPS URL:
---
type:howto, reference
---
```
git clone PASTE HTTPS OR SSH HERE
```
A clone of the project will be created in your computer.
NOTE: **Note:**
If you clone your project via a URL that contains special characters, make sure
that characters are URL-encoded.
### Go into a project directory to work in it
```
cd NAME-OF-PROJECT
```
# Command Line basic commands
### Go back one directory
When [working with Git from the command line](start-using-git.md), you will need to
use more than just the Git commands. There are several basic commands that you should
learn, in order to make full use of the command line.
```
cd ..
```
## Start working on your project
### List what’s in the current directory
To work on a git project locally (from your own computer), with the command line,
first you will need to [clone (copy) it](start-using-git.md#clone-a-repository) to
your computer.
```
ls
```
## Working with files on the command line
### List what’s in the current directory that starts with `a`
This section has examples of some basic shell commands that you might find useful.
For more information, search the web for _bash commands_.
```
ls a*
```
Alternatively, you can edit files using your choice of editor (IDE), or the GitLab user
interface (not locally).
### List what’s in the current directory that ends with `.md`
### Common commands
```
ls *.md
```
The list below is not exhaustive, but contains many of the most commonly used commands.
| `cd NAME-OF-DIRECTORY` | Go into a directory to work in it |
| `cd ..` | Go back one directory |
| `ls` | List what’s in the current directory |
| `ls a*` | List what’s in the current directory that starts with `a` |
| `ls *.md` | List what’s in the current directory that ends with `.md` |
| `mkdir NAME-OF-YOUR-DIRECTORY` | Create a new directory |
| `cat README.md` | Display the contents of a [text file you created previously](#create-a-text-file-in-the-current-directory) |
| `pwd` | Show the current directory |
| `clear` | Clear the shell window |
```
mkdir NAME-OF-YOUR-DIRECTORY
```
### Create a text file in the current directory
### Create a README.md file in the current directory
To create a text file from the command line, for example `README.md`, follow these
steps:
```
touch README.md
...
...
@@ -80,37 +52,37 @@ nano README.md
#### Press: enter
```
### Show the contents of the README.md file
### Remove a file or directory
```
cat README.md
```
### Remove a file
It is easy to delete (remove) a file or directory, but be careful:
DANGER: **Danger:**
This will permanently delete the file.
This will **permanently** delete a file.
```
rm NAME-OF-FILE
```
### Remove a directory and all of its contents
DANGER: **Danger:**
This will permanently delete the directory and all of its contents.
This will **permanently** delete a directory and **all** of its contents.
```
rm -r NAME-OF-DIRECTORY
```
### View command history
### View and Execute commands from history
You can view the history of all the commands you executed from the command line,
and then execute any of them again, if needed.
First, list the commands you executed previously:
```
history
```
### Execute command 123 from history
Then, choose a command from the list and check the number next to the command (`123`,
for example) . Execute the same full command with:
```
!123
...
...
@@ -118,28 +90,32 @@ history
### Carry out commands for which the account you are using lacks authority
You will be asked for an administrator’s password.
Not all commands can be executed from a basic user account on a computer, you may
need administrator's rights to execute commands that affect the system, or try to access
protected data, for example. You can use `sudo` to execute these commands, but you
will likely be asked for an administrator password.
```
sudo COMMAND
sudo RESTRICTED-COMMAND
```
CAUTION: **Caution:**
Be careful of the commands you run with `sudo`. Certain commands may cause
damage to your data and system.
damage to your data or system.
### Show which directory I am in
## Sample Git taskflow
```
pwd
```
### Clear the shell window
If you are completely new to Git, looking through some [sample taskflows](https://rogerdudler.github.io/git-guide/)
will help you understand the best practices for using these commands as you work.
```
clear
```
<!-- ## Troubleshooting
### Sample Git taskflow
Include any troubleshooting steps that you can foresee. If you know beforehand what issues
one might have when setting this up, or when something is changed, or on upgrading, it's
important to describe those, too. Think of things that may go wrong and include them here.
This is important to minimize requests for support, and to avoid doc comments with
questions that you know someone might ask.
If you are completely new to Git, looking through some [sample taskflows](https://rogerdudler.github.io/git-guide/) will help you understand best practices for using these commands as you work.
Each scenario can be a third-level heading, e.g. `### Getting error message X`.
If you have none to add when creating a doc, leave this section in place
but commented out to help encourage others to add to it in the future. -->
Creating new projects based on custom project templates is a convenient option to bootstrap a project.
Creating new projects based on custom project templates is a convenient option to
bootstrap a project.
Custom projects are available from the **Instance** or **Group** tabs under the **Create from template** tab,
depending on the type of template.
Custom projects are available at the [instance-level](../user/admin_area/custom_project_templates.md)
from the **Instance** tab, or at the [group-level](../user/group/custom_project_templates.md)
from the **Group** tab, under the **Create from template** tab.
To use a custom project template on the **New project** page:
...
...
@@ -85,23 +96,19 @@ To use a custom project template on the **New project** page:
1. From the list of available custom templates, click the:
-**Preview** button to look at the template source itself.
-**Use template** button to start creating the project.
1. Finish creating the project by filling out the project's details. The process is the same as for
using a [blank project](#blank-projects).
For information on configuring custom project templates, see:
-[Custom instance-level project templates](../user/admin_area/custom_project_templates.md), for instance-level templates.
-[Custom group-level project templates](../user/group/custom_project_templates.md), for group-level templates.
1. Finish creating the project by filling out the project's details. The process is
the same as creating a [blank project](#blank-projects).
## Push to create a new project
> [Introduced](https://gitlab.com/gitlab-org/gitlab-ce/issues/26388) in GitLab 10.5.
When you create a new repo locally, instead of going to GitLab to manually
create a new project and then push the repo, you can directly push it to
GitLab to create the new project, all without leaving your terminal. If you have access to that
namespace, we will automatically create a new project under that GitLab namespace with its
visibility set to Private by default (you can later change it in the [project's settings](../public_access/public_access.md#how-to-change-project-visibility)).
When you create a new repository locally, instead of going to GitLab to manually
create a new project and then [clone the repo](start-using-git.md#clone-a-repository)
locally, you can directly push it to GitLab to create the new project, all without leaving
your terminal. If you have access rights to the associated namespace, GitLab will
automatically create a new project under that GitLab namespace with its visibility
set to Private by default (you can later change it in the [project's settings](../public_access/public_access.md#how-to-change-project-visibility)).
This can be done by using either SSH or HTTPS:
...
...
@@ -127,3 +134,15 @@ remote: To view the project, visit: