• Home
  • Blog
  • How to add an existing project to GIT?

How to add an existing project to GIT?

Image

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.

21 Comments Text
  • 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

  • graliontorile says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    F*ckin’ remarkable things here. I am very glad to see your article. Thanks a lot and i’m looking forward to contact you. Will you kindly drop me a e-mail?
  • bestnocreditcheckloans.Com says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    I think I know what you mean, but I want some detail. Can I PM you?
  • Beauty says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Hey There. I found your blog using msn. This is an extremely well written article. I will make sure to bookmark it and return to read more of your useful information. Thanks for the post. I抣l certainly comeback.
  • gralion torile says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    You have mentioned very interesting details! ps decent web site.
  • loan-Reviews.Net says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Paragraph writing is also a fun, if you be acquainted with after that you can write if not it is difficult to write.
  • vorbelutr ioperbir says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Great info and right to the point. I am not sure if this is truly the best place to ask but do you people have any ideea where to employ some professional writers? Thanks in advance 🙂
  • zoritoler imol says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Perfect work you have done, this site is really cool with superb info .
  • Kaannokset.hellberg says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Nice weblog here! A big thank you for your blog article. Want more
  • oCRYTEKo says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    In my view, this blog is excellent. Excited to read more. Truly great.
  • Kwerey says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Upon reviewing a few of your blog posts, I genuinely like your approach to blogging. It’s in my bookmarked list now, and I’ll be checking back soon. Explore my site and let me know your thoughts.
  • Svetywylka says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    I really like your unique perspective in this blog post. Looking forward to reading more insightful content from you!
  • honeybunny says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    This is, without a doubt, an excellent blog. Looking forward to more reading. Absolutely fantastic.
  • Yellow-Cadavre says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    I appreciate your attention to detail in this blog post. Eager to read more of your work in the future.
  • enjoyed this post. It's clear you put a lot of effort into your blog, and it shows. Thanks for writing! says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    This was a fantastic read. Nice blog you have, and I’m thankful for the value you provide in your posts.
  • msjulia says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    After checking out a couple of your blog posts, I really like your blogging technique. It’s bookmarked, and I’ll be back soon. Explore my site and let me know your thoughts.
  • loky1992 says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Thanks for sharing such an enlightening post. I appreciate your blog and always look forward to new updates.
  • vorbelutrioperbir says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Heya i am for the first time here. I found this board and I find It truly useful & it helped me out much. I hope to give something back and help others like you helped me.
  • zoritoler imol says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    When I initially commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several e-mails with the same comment. Is there any way you can remove people from that service? Thanks a lot!
  • SeregaS says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    Having perused a few of your blog posts, I truly appreciate your unique blogging style. It’s now bookmarked, and I’ll be back soon. Check out my website and share your opinions.
  • set up gold ira says:
    Your comment is awaiting moderation. This is a preview; your comment will be visible after it has been approved.
    You’re so cool! I do not suppose I’ve truly read through a single thing like that before. So nice to discover someone with a few unique thoughts on this subject. Seriously.. thank you for starting this up. This web site is one thing that’s needed on the web, someone with a little originality!
  • Leave a Comment

    Your email address will not be published. Required fields are marked *