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