BigW Consortium Gitlab

command-line-commands.md 1.77 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
When you are on your Dashboard, click on the project that you'd like to clone, which you'll find at the right side of your screen.
8 9 10

![Select a project](basicsimages/select_project.png)

11
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). When you're in the project, click on the HTTPS or SSH button at the right side of your screen. Then copy the link (you'll have to paste it on your shell in the next step).
12

karen Carias committed
13
![Copy the HTTPS or SSH](basicsimages/https.png)
14

karen Carias committed
15
## On the command line
16

17 18
### Clone your project
Go to your computer's shell and type the following command:
karen Carias committed
19 20 21 22
```
git clone PASTE HTTPS OR SSH HERE
```

23
A clone of the project will be created in your computer.
karen Carias committed
24

25
### Go into a project, directory or file to work in it
karen Carias committed
26 27 28
```
cd NAME-OF-PROJECT-OR-FILE
```
29

30
### Go back one directory or file
31
```
karen Carias committed
32
cd ../
33 34
```

35
### View what’s in the directory that you are in
karen Carias committed
36 37 38 39
```
ls
```

40
### Create a directory
karen Carias committed
41 42 43 44
```
mkdir NAME-OF-YOUR-DIRECTORY
```

45
### Create a README.md or file in directory
karen Carias committed
46 47 48 49 50 51 52 53 54
```
touch README.md
nano README.md
#### ADD YOUR INFORMATION
#### Press: control + X
#### Type: Y
#### Press: enter
```

55
### Remove a file
karen Carias committed
56 57 58 59
```
rm NAME-OF-FILE
```

60
### Remove a directory and all of its contents
karen Carias committed
61 62 63 64
```
rm -rf NAME-OF-DIRECTORY
```

65
### View history in the command line
karen Carias committed
66 67 68 69
```
history
```

70 71
### Carry out commands for which the account you are using lacks authority
You will be asked for an administrator’s password.
karen Carias committed
72 73 74
```
sudo
```
karen Carias committed
75 76 77 78 79

### Tell where you are
```
pwd
```