Yay! What’s up? On this article we will summarize the first steps everyone should follow when it comes to deploying your own Git server. Don’t have any yet? Read this article.
Keep in mind that any host with the Git software installed and Internet connection can be a Git server, you just need to configure a SSH connection to be able to use it.
You can install Git on your Raspberry Pi, a virtual machine on your server, on the cloud… Whatever you want, just install it!
Remote server
Ok, right. Now you have the Git software installed, but you need to create the repository first. How to do it? Very simple, just go to the directory where you want to set up the repository (remember! It needs to be accessible through SSH):
# change directory
cd /home/cooluser/repositories/
# make new directory with .git extension
mkdir coolrepo.git
# come inside
cd coolrepo.git
# run the init command
git init --bare
Local machine
Create the directory where you want to have this repository
mkdir coolrepo
cd coolrepo
Now, you need to prepare this directory for git:
git init
touch README.md
git add .
git commit -m "First commit" -a
git remote add origin ssh://[email protected]_ip:/home/cooluser/repositories/coolrepo.git
git push origin master
Et voila, you have your own repository with full functionality.
In the future, you can do a git clone
like:
git clone [email protected]_ip:/home/cooluser/repositories/coolrepo.git
Cheers!
hello, thanks for all,
i used the config. “First steps with git server; the right way” and ” Build your own git server on WD MyCloud ” but i get this Problem when i push the Changes to git Server:
fatal: the remote end hung up unexpectedly
[2022-05-11T18:28:36.565Z] > git push –force-with-lease origin svn_git:svn_git [4614ms]
[2022-05-11T18:28:36.565Z] remote: fatal: write error: No space left on device
fatal: sha1 file ” write error: Broken pipe
error: remote unpack failed: index-pack abnormal exit
To ssh://MyCloudEX2Ultra:/home/git/repositories/Projects.git
! [remote rejected] svn_git -> svn_git (unpacker error)
error: failed to push some refs to ‘ssh://MyCloudEX2Ultra:/home/git/repositories/Projects.git’
best regards
Rabii
Hello Rabii, sorry for the delay.
I try again the tutorial and i dont have any error. Maybe you need to specified the IP and not the hostname?
And you need to add the sshd user to the url repo, like ssh://[email protected]_ADDRES:/home/git/repositories/Projects.git
Regards!