I have come across this problem more times than I would like to admit when I am looking for “How to add an existing project to GIT” because I have a project which I have started working on but is not in GIT and now I need to recall the steps to add it.
If you are in the same boat this is definitely the blog you were looking for.
Steps to Add your Project to GIT
The steps are simple and the task gets too easy with this.
Step 1: Create a GIT repository project in your GITHUB account or your own GITLAB/GIT environment. Let’s create it without a README.MD file.
Step 2: Copy the HTTPS URL for your repository. For me the URL is
https://github.com/v13s/healthLine.git
Step 3: Next, get to the command line and go to your project directory.
Now, a GIT repository has a local and a remote repository. Let’s get started with the local first since you already have your project ready.
Step 4: In your project directory, initialize your local GIT Repository.
git init -b main
Step 5: Now that we have your local repository ready, now let’s connect it to the remote repository. The general convention is to name the connection as ‘origin’ and we will do it that way. However, you are free to choose your connection name as you please.
git remote add origin https://github.com/v13s/healthLine.git
Step 6 (Optional): Check the connections.
git remote -v
Your result should look something like this.
origin https://github.com/v13s/healthLine.git (fetch)
origin https://github.com/v13s/healthLine.git (push)
Step 7: Now that you are ready with your connection, let’s Stage the changes. This would mark all the changes/files previously unstaged as ‘Staged’.
git add .
Step 8: Once Staged, the next step would be to commit those changes to the local repository. It is mandatory to add message or remarks for your commit.
git commit -m "initial commit"
Optionally you can sign off the changes too using the ‘-s’ flag.
git commit -s -m "initial commit"
Step 9: Final step would be to push your changes to the remote repository
git push origin main
And Voila!!
Shoutout to Roman Synkevych for the featured image.
I love your blog.. very nice colors & theme. Did you create this website yourself or did you hire someone to do it for you? Plz answer back as I’m looking to design my own blog and would like to find out where u got this from. thanks a lot