debian-mirror-gitlab/doc/gitlab-basics/command-line-commands.md

94 lines
1.7 KiB
Markdown
Raw Normal View History

2015-09-11 14:41:01 +05:30
# Command Line basic commands
## Start working on your project
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.
2016-11-03 12:29:30 +05:30
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).
2015-09-11 14:41:01 +05:30
2016-11-03 12:29:30 +05:30
![Copy the HTTPS or SSH](img/project_clone_url.png)
2015-09-11 14:41:01 +05:30
## On the command line
### Clone your project
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
Go to your computer's shell and type the following command:
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
git clone PASTE HTTPS OR SSH HERE
```
A clone of the project will be created in your computer.
### Go into a project, directory or file to work in it
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
cd NAME-OF-PROJECT-OR-FILE
```
### Go back one directory or file
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
cd ../
```
### View whats in the directory that you are in
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
ls
```
### Create a directory
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
mkdir NAME-OF-YOUR-DIRECTORY
```
### Create a README.md or file in directory
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
touch README.md
nano README.md
#### ADD YOUR INFORMATION
#### Press: control + X
#### Type: Y
#### Press: enter
```
### Remove a file
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
rm NAME-OF-FILE
```
### Remove a directory and all of its contents
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
rm -rf NAME-OF-DIRECTORY
```
### View history in the command line
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
history
```
### Carry out commands for which the account you are using lacks authority
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
You will be asked for an administrators password.
2016-11-03 12:29:30 +05:30
2015-09-11 14:41:01 +05:30
```
sudo
```
2015-09-25 12:07:36 +05:30
### Tell where you are
2016-11-03 12:29:30 +05:30
2015-09-25 12:07:36 +05:30
```
pwd
```