Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a bare repository on a Git server remotely

Tags:

git

ssh

Is there any way to create bare repositories on a Git server remotely from my local machine?

I'm trying to eliminate the annoyance of having to ssh in to my Git server and create the bare repo manually.

It's probably not possible, but ideally I'd like to create local git repositories, and push them straight away to my Git server without having to create bare versions on the server first.

Am I asking too much of Git?

like image 700
shennan Avatar asked Aug 30 '15 16:08

shennan


People also ask

How do I create a git bare repository?

There are two ways to create a bare Git repo: Clone an existing repository with the git clone –bare switch. Create a new bare git repo with the git init –bare switch.

How do I initialize a remote git repository?

git init : One Person Starting a New Repository Locally First, initialize the repository and make at least one commit. Once you have initialized the repository, create a remote repository somewhere like GitHub.com. Then, add the remote URL to your local git repository with git remote add origin <URL> .

What is a bare git repository?

A bare Git repository is typically used as a Remote Repository that is sharing a repository among several different people. You don't do work right inside the remote repository so there's no Working Tree (the files in your project that you edit), just bare repository data.

Can you use git without a remote repository?

So, whether you decide to share your code with a team via a server or use it to manage your code locally, your repository looks the same. So, that's why you can use Git without GitHub: Git works as a standalone tool or with a server. Let's talk about Git's version-control features.


1 Answers

I think the best way is through ssh, something like:

$ ssh remoteserver 'git init --bare YOURPATH/REPONAME'

You can configure to use SSH as password-less if you are going to use it lot of times.

like image 151
Assem Avatar answered Oct 17 '22 17:10

Assem