BigW Consortium Gitlab

command-line-commands.md 1.82 KB
Newer Older
karen Carias committed
1
# Command Line basic commands
2 3 4

## Start working on your project

karen Carias committed
5
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.
6

7 8 9 10 11 12
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
[setup](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 to clipboard'
button (you'll have to paste it on your shell in the next step).
13

14
![Copy the HTTPS or SSH](img/project_clone_url.png)
15

karen Carias committed
16
## On the command line
17

18
### Clone your project
19

20
Go to your computer's shell and type the following command:
21

karen Carias committed
22 23 24 25
```
git clone PASTE HTTPS OR SSH HERE
```

26
A clone of the project will be created in your computer.
karen Carias committed
27

JeJe committed
28
>**Note:** If you clone your project via an URL that contains special characters, make sure that they are URL-encoded.
29

30
### Go into a project, directory or file to work in it
31

karen Carias committed
32 33 34
```
cd NAME-OF-PROJECT-OR-FILE
```
35

36
### Go back one directory or file
37

38
```
karen Carias committed
39
cd ../
40 41
```

42
### View what’s in the directory that you are in
43

karen Carias committed
44 45 46 47
```
ls
```

48
### Create a directory
49

karen Carias committed
50 51 52 53
```
mkdir NAME-OF-YOUR-DIRECTORY
```

54
### Create a README.md or file in directory
55

karen Carias committed
56 57 58 59 60 61 62 63 64
```
touch README.md
nano README.md
#### ADD YOUR INFORMATION
#### Press: control + X
#### Type: Y
#### Press: enter
```

65
### Remove a file
66

karen Carias committed
67 68 69 70
```
rm NAME-OF-FILE
```

71
### Remove a directory and all of its contents
72

karen Carias committed
73 74 75 76
```
rm -rf NAME-OF-DIRECTORY
```

77
### View history in the command line
78

karen Carias committed
79 80 81 82
```
history
```

83
### Carry out commands for which the account you are using lacks authority
84

85
You will be asked for an administrator’s password.
86

karen Carias committed
87 88 89
```
sudo
```
karen Carias committed
90 91

### Tell where you are
92

karen Carias committed
93 94 95
```
pwd
```