GIT: the best way to set up a new repo

With the creation of a new git repo, I want to know what works best. The ether creates the git repository locally and is pushed, or remotely, and pulled out. ,

Method 1

Local computer (inside any project folder)

git init
git add .
git commit -m 'initial commit'
git remote add origin <server-repo-url>
git push --all origin

Or is it better to configure the repo on the server and then fetch it to the local computer?

Method 2

Remote server

mkdir myrepo.git
cd myrepo.git
git --bare init

Or does it even matter?

+3
source share
2 answers

It does not really matter. Git is designed to enable the sharing of equivalent repositories between clients and servers. As long as your client is fully configured to work with the repository on the server, they are both great.

+2
source

. , .

+1

All Articles