finisg gitlab section for a new repo

This commit is contained in:
Ric Harvey 2024-05-03 12:29:44 +01:00
parent 11d2dae6a2
commit 575ed85762
Signed by: ric
GPG key ID: CD63CE502B962F16
2 changed files with 13 additions and 2 deletions

View file

@ -1,3 +1,4 @@
# Committing Code
## Adding files
Before you can commit your work to local or remote repositories you need to make sure git is tracking the file you have changed, otherwise those changes won't sync. To add a specific file to the git repository run the command:

View file

@ -34,22 +34,32 @@ Lets look at how you can set up a new remote repository on Gitlab/Github, so you
> 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
Now you have the URL you can go back to your terminal and clone the repository.
```bash
git clone git@gitlab.com:ric_harvey/demo-project.git
```
you are now ready to get going committing code! Head over to the [commit.md](./commit.md) file for information on what to do next.
### Adding existing files to a git repository
Now if you have already been working hard and you have files already you can import these files. By following the following instructions. You'll still need that SSH URL you copied.
```bash
cd existing_repo
cd existing_directory
git init
git remote add origin https://gitlab.com/ric_harvey/demo-project.git
git branch -M main
git add .
git commit -m "first commit"
git push -uf origin main
```
## Cloning an existing repository
This will now sync all your your files up to the remote repository.
---
##### Follow me for more guides