Reputation: 379
I'm not talking about git remote add
, I'm talking about actually creating "the remote", like one on GitHub, the one you have to add with git remote add
. From what I know a remote is just another copy of a repo, but it's stored on some dedicated machine. I want to try hosting something like that on my local network, so I can have bootleg GitHub at home. Is it possible?
Upvotes: 2
Views: 3192
Reputation: 8501
Yes, what you are looking for is a Git "server".
The double quotes are, as others mentioned it as well, because Git doesn't really require an instance running as a server. Every Git repository is a "server" you can clone.
However, if you search for "run git server locally" in Google, you'll find plenty of results.
Referencing some of the steps from one easy example:
sudo apt-get install git-core
mkdir -p $HOME/project-1.git
cd $HOME/project-1.git
git init --bare
git remote add origin ssh://git@remote-server/<path>
Upvotes: 2
Reputation: 8978
The remote concept of git actually refers to any remote repository, it doesn't need to be some kind of specific server. So if you just create a repo locally on your machine, it can be added as a remote for another git repo.
Upvotes: 1
Reputation: 37227
Git doesn't even need a dedicated "server" when working over SSH.
If you have shell access and appropriate permissions, you can run git init --bare
in an empty directory to turn it into a Git repository. Then you can add username@hostname:path/to/dir
as a Git remote and do your normal pulls and pushes, leveraging your normal SSH access, including any host aliases and config defined in ~/.ssh/config
.
If you're only looking to storing your code on a remote server this is the easiest way to go.
Upvotes: 4