Nam G VU
Nam G VU

Reputation: 35374

Locally hosted repository for GIT similarly to SVN local one?

A google search for Locally hosted repository for GIT similarly to SVN local one? give me nothing helpful so I ask our community here - is it possible to create a local repo using Git similarly to what we can do with SVN local repo i.e. no need for an SVN/Git server, we store it locally right on our PC's hard drive?

Upvotes: 2

Views: 40

Answers (2)

VonC
VonC

Reputation: 1323943

You can create a local Git repo, but you wouldn't "push" after that.

You would directly work in that local Git repo which will include all your history:

git init myrepo
cd myrepo
# copy/create files there
git add .
git commit -m "my files"
# work
git add .
git commit -m "my work"
...

If you want to push that local repo to a newly created empty GitHub repo for example, you would need:

  • first to login to GitHub and create an empty repo
  • secondly, to add that remote to your local repo

    git remote add origin https://<yourlogin>@github.com/<yourlogin>/<yourRepo>
    
  • finally, you could push to it:

    git push -u origin master   
    

Upvotes: 1

chepner
chepner

Reputation: 531055

Just run git init in any directory, and that directory is a Git repository.

Upvotes: 2

Related Questions