mirror of
https://gitlab.com/ric_harvey/git-guide.git
synced 2024-11-27 13:24:03 +00:00
adding creatig new repo in gitlab
This commit is contained in:
parent
a297e69271
commit
11d2dae6a2
6 changed files with 44 additions and 0 deletions
|
@ -1,9 +1,53 @@
|
|||
# Creating and Cloning a Repository
|
||||
## Setting up a new repository
|
||||
|
||||
Lets look at how you can set up a new remote repository on Gitlab/Github, so you are ready to start committing your code. the easist way is to create a new repository in Gitlab/Github, clone it locally then start adding your files to it. We'll look at this method first.
|
||||
|
||||
<details>
|
||||
<summary>Using Gitlab</summary>
|
||||
#### Gitlab
|
||||
|
||||
- Open Gitlab in your browser and log in
|
||||
- Now click **new project** on the right hand side of the interface
|
||||
|
||||
![Create a New Project](./img/create-new-project.png)
|
||||
|
||||
- You'll now be asked what template do you want to use, I recommend a blank project unless your use case fits with the other options
|
||||
|
||||
![Select Template for Repo](./img/select-project-type.png)
|
||||
|
||||
- Now it's time to give your project a name. You can also set if the project is public or private at this time (although this can be changed later)
|
||||
|
||||
![Setup your project](./img/setup-project.png)
|
||||
|
||||
- Once done click **create project** at the bottom of the page
|
||||
- You'll be taken to the next page which shows you a bare bones repository. (It should have a README.md file if you didn't change the setting to create one)
|
||||
|
||||
![New repository is now created](./img/project-created.png)
|
||||
#### Get the project URL
|
||||
|
||||
- The next step is to get the URL for the git repository you want to clone. You can do this by going to the green **code** button and clicking it.
|
||||
- If you intend to commit code back select the SSH URL.
|
||||
|
||||
![Get the SSH URL](./img/clone-repo.png)
|
||||
|
||||
> If you want to just pull the code down to use locally you can use HTTPS, this is especially useful if you don't have permissions on the repository.
|
||||
|
||||
</details>
|
||||
### Clone the new repository
|
||||
|
||||
```bash
|
||||
git clone git@gitlab.com:ric_harvey/demo-project.git
|
||||
```
|
||||
|
||||
### Adding existing files to a git repository
|
||||
|
||||
```bash
|
||||
cd existing_repo
|
||||
git remote add origin https://gitlab.com/ric_harvey/demo-project.git
|
||||
git branch -M main
|
||||
git push -uf origin main
|
||||
```
|
||||
|
||||
## Cloning an existing repository
|
||||
|
||||
|
|
BIN
img/clone-repo.png
Normal file
BIN
img/clone-repo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 135 KiB |
BIN
img/create-new-project.png
Normal file
BIN
img/create-new-project.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
img/project-created.png
Normal file
BIN
img/project-created.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 180 KiB |
BIN
img/select-project-type.png
Normal file
BIN
img/select-project-type.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
BIN
img/setup-project.png
Normal file
BIN
img/setup-project.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 KiB |
Loading…
Reference in a new issue