سؤال

With creating a fresh git repo, I am wanting to know what is best practice. Ether creating the git repo locally and pushed, or remotely and pulled. .

Method 1

Local machine (inside whatever 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 practice to set up the repo on the server and then pull from it onto your local machine?

Method 2

Remote server

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

Or does it even matter?

هل كانت مفيدة؟

المحلول

It doesn't particularly matter. Git is designed to allow the equivalent repositories to be shared between clients and servers. So long as your client(s) are fully configured to work with a repository on the server, they're both great.

نصائح أخرى

Doesn't matter. Either repo can be discarded once both are up and running.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top