Coder Bee
Published in

Coder Bee

How To Set Up A Git Repository?

A Git Repository is a cloud storage for your software

Photo by frank mckenna on Unsplash

This is continuation of Git Basics series.

  1. Know Your Git Terminologies

Local Git Repository:

Setting up a local repository is pretty simple. By local repository I mean making your project a git repo on your work-station.

Open git-bash. Navigate to root of your project folder. In my case it is — android-test.

Sowmya\android-test$ git init

Syncing With a Remote Repository:

Congrats! Now your project is a git repository. If you want to upload it to a remote repository(have a copy in the cloud) you could use a cloud hosting service like github, Gitlab or bitbucket. In my case, I am using a github repo.

So all you need to do is sign up and create a repository in Github.

Copy the https or ssh link to the repository.

$ git remote add origin git@github.com:username/your-repo-name.git

If you have cloned a repository using git clone the repository already has the link to the remote repo, so you can skip the previous step of — git init.

To index all your changes,

Commit your changes with an appropriate commit message.

$ git commit -m "Initial Commit"

Issue command push when your ready to push your changes to the remote repository.

$ git push -u origin master

You might need to provide your github credentials and once authenticated your repos will be pushed to your online repository.

Tada! Now you have successfully pushed to a remote repository.

Enjoy…

Got a question? Leave a comment.

Originally published at https://sowmyasguru.blogspot.com.