Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
bc7787b9
Commit
bc7787b9
authored
Jun 12, 2018
by
Edwin Torres
Committed by
Achilleas Pipinellis
Jun 12, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed/enhanced command-line documentation
parent
e4c1ada4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
45 additions
and
13 deletions
+45
-13
doc/gitlab-basics/command-line-commands.md
doc/gitlab-basics/command-line-commands.md
+45
-13
No files found.
doc/gitlab-basics/command-line-commands.md
View file @
bc7787b9
...
@@ -7,17 +7,19 @@ In Git, when you copy a project you say you "clone" it. To work on a git project
...
@@ -7,17 +7,19 @@ In Git, when you copy a project you say you "clone" it. To work on a git project
When you are on your Dashboard, click on the project that you'd like to clone.
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
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
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
[
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 to clipboard'
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).
button (you'll have to paste it on your shell in the next step).
![
Copy the HTTPS or SSH
](
img/project_clone_url.png
)
![
Copy the HTTPS or SSH
](
img/project_clone_url.png
)
## On the command line
## 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_.
### Clone your project
### Clone your project
Go to your computer's shell and type the following command:
Go to your computer's shell and type the following command
with your SSH or HTTPS URL
:
```
```
git clone PASTE HTTPS OR SSH HERE
git clone PASTE HTTPS OR SSH HERE
...
@@ -25,33 +27,45 @@ git clone PASTE HTTPS OR SSH HERE
...
@@ -25,33 +27,45 @@ git clone PASTE HTTPS OR SSH HERE
A clone of the project will be created in your computer.
A clone of the project will be created in your computer.
>**Note:** If you clone your project via a
n URL that contains special characters, make sure that they
are URL-encoded.
>**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 or file
to work in it
### Go into a project
directory
to work in it
```
```
cd NAME-OF-PROJECT
-OR-FILE
cd NAME-OF-PROJECT
```
```
### Go back one directory
or file
### Go back one directory
```
```
cd ..
/
cd ..
```
```
###
View what’s in the directory that you are in
###
List what’s in the current directory
```
```
ls
ls
```
```
### Create a directory
### List what’s in the current directory that starts with `a`
```
ls a*
```
### List what’s in the current directory that ends with `.md`
```
ls *.md
```
### Create a new directory
```
```
mkdir NAME-OF-YOUR-DIRECTORY
mkdir NAME-OF-YOUR-DIRECTORY
```
```
### Create a README.md
or file in
directory
### Create a README.md
file in the current
directory
```
```
touch README.md
touch README.md
...
@@ -62,6 +76,12 @@ nano README.md
...
@@ -62,6 +76,12 @@ nano README.md
#### Press: enter
#### Press: enter
```
```
### Show the contents of the README.md file
```
cat README.md
```
### Remove a file
### Remove a file
```
```
...
@@ -74,12 +94,18 @@ rm NAME-OF-FILE
...
@@ -74,12 +94,18 @@ rm NAME-OF-FILE
rm -r NAME-OF-DIRECTORY
rm -r NAME-OF-DIRECTORY
```
```
### View
history in the command line
### View
command history
```
```
history
history
```
```
### Execute command 123 from history
```
!123
```
### Carry out commands for which the account you are using lacks authority
### Carry out commands for which the account you are using lacks authority
You will be asked for an administrator’s password.
You will be asked for an administrator’s password.
...
@@ -88,8 +114,14 @@ You will be asked for an administrator’s password.
...
@@ -88,8 +114,14 @@ You will be asked for an administrator’s password.
sudo
sudo
```
```
###
Tell where you are
###
Show which directory I am in
```
```
pwd
pwd
```
```
### Clear the shell window
```
clear
```
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment