Aniket
Aniket

Reputation: 5368

Initialize a git repository remotely

I have a scenario wherin I want to initialize a git repo remotely on type of the command git init.

Now when I do a git init, it creates a repository in the current directory. But what I want to do is, I want to create a create a git repo remotely.

Something like git init

I dont want to a git init and then do a git push.

Is it possible?

Upvotes: 1

Views: 70

Answers (2)

yelsayed
yelsayed

Reputation: 5542

Log in to the remote server, create a new directory and initialize it:

mkdir new_repo.git
cd new_repo.git
git init --bare

Make sure you configure permissions correctly if needed, then just set your local working repo's remote to the server address.

Take a look at this for the difference between git init and git init --bare.

Upvotes: 0

Borealid
Borealid

Reputation: 98509

You can do an ssh otherhost git init /path/to/repo.

Upvotes: 1

Related Questions