BigW Consortium Gitlab

command-line-commands.md 1.7 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

28
### Go into a project, directory or file to work in it
29

karen Carias committed
30 31 32
```
cd NAME-OF-PROJECT-OR-FILE
```
33

34
### Go back one directory or file
35

36
```
karen Carias committed
37
cd ../
38 39
```

40
### View what’s in the directory that you are in
41

karen Carias committed
42 43 44 45
```
ls
```

46
### Create a directory
47

karen Carias committed
48 49 50 51
```
mkdir NAME-OF-YOUR-DIRECTORY
```

52
### Create a README.md or file in directory
53

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

63
### Remove a file
64

karen Carias committed
65 66 67 68
```
rm NAME-OF-FILE
```

69
### Remove a directory and all of its contents
70

karen Carias committed
71 72 73 74
```
rm -rf NAME-OF-DIRECTORY
```

75
### View history in the command line
76

karen Carias committed
77 78 79 80
```
history
```

81
### Carry out commands for which the account you are using lacks authority
82

83
You will be asked for an administrator’s password.
84

karen Carias committed
85 86 87
```
sudo
```
karen Carias committed
88 89

### Tell where you are
90

karen Carias committed
91 92 93
```
pwd
```