0

I have given a computer within my local network, which for all practical purposes can only be controlled via BASH (Ubuntu Server 22.0.4), a static IP address, and created a Git repository on it. Should I expect to be able to clone that repo right away, or are there some tools I need before I can actually have a URL?

I have read How to find a url for a local GIT repo, and $git config --get remote.origin.url, less .shh/config, git remote show do not show me anything.

I am currently only able to access this computer within my local network, it has not been registered on any DNS. I want to establish that I can use it as a local Git server before I take the following steps and get DNS registration.

I would expect that I should be able to open GitHub on another computer in the network and tell it to clone https://192.168.0.225/[something]. I saw a mention of Gitosis. Is that sufficient to make a locally created repo accessible to other computers?

torek
  • 448,244
  • 59
  • 642
  • 775
Post169
  • 668
  • 8
  • 26
  • The fact that bash is involved here on the server isn't particularly relevant. You just need to be able to run commands on the server; Git deliberately uses very simple operations here to avoid depending on the particular command-line-interpreter. – torek Dec 03 '22 at 00:24

1 Answers1

1

You'll be connecting via ssh, so all you need is the IP address and the path to the repository.

git clone 192.168.0.225:/path/to/repository

should work fine. The above is shorthand for a more formal URL like

git clone ssh://192.168.0.225/path/to/repository
chepner
  • 497,756
  • 71
  • 530
  • 681
  • Thanks, this looks promising! To clarify, only the headless server computer is BASH; the rest are Windows. I would like to clone this repo using the GitHub app, if possible. It asks for the local directory to save the repo in, and the remote URL. So, I'll see if it accepts URL's that begin not in "HTML" or "HTMLS", but in "SSH". – Post169 Dec 02 '22 at 22:44
  • It should; http, ssh, and git's own internal (authentication-free) protocols are built-in to Git. In the worst case, you can write your own remote helper to tell Git how to communicate over some other connection mechanism. (See `man gitremote-helpers` for more information, but to be clear, you almost certainly do not need to do this.) – chepner Dec 02 '22 at 23:31
  • Also you can add it as remote to your existing local repository: `git remote add nameOfYourChoice user@192.168.0.225/path/to/repository` The remote will then be available as "nameOfYourChoice" similiar to "origin". If you have more than one remote, you may want to look into the config option `checkout.defaultRemote`: https://git-scm.com/docs/git-config#Documentation/git-config.txt-checkoutdefaultRemote – Jay Dec 05 '22 at 10:44