From 575ed857621bcb9d8ccac2a75986b7dee445ba7a Mon Sep 17 00:00:00 2001 From: Ric Harvey Date: Fri, 3 May 2024 12:29:44 +0100 Subject: [PATCH] finisg gitlab section for a new repo --- commit.md | 1 + getting-code.md | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/commit.md b/commit.md index 5eda6ec..78dc299 100644 --- a/commit.md +++ b/commit.md @@ -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: diff --git a/getting-code.md b/getting-code.md index 7a64a03..cbfb228 100644 --- a/getting-code.md +++ b/getting-code.md @@ -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. + ### 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