Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of building Git server by Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Install Git

Yum install-y gitgit-- version

Create a Git user

Sudo adduser git// sets password passwd git

Import public key

Find /-name authorized_keysvim / root/.ssh/authorized_keys

Create a Git repository

# cut to the specified directory sudo git init-- bare server.git# owner specified as gitsudo chown-R git:git server.git

Disable git user Shell

Change git:x:502:502::/home/git:/bin/bash to git:x:502:502::/home/git:/usr/bin/git-shell in the / etc/passwd file

Clone code to local

Git clone git@127.0.0.1:/web/mazey.cn/server/server.git

Be careful

If there is a permission problem with git push:

Fatal: Unable to create temporary file: Permission deniedfatal: sha1 file''write error: Broken pipeerror: failed to push some refs to' git@0.0.0.0:/web/mazey.cn/server/server.git'

Execute the following command:

Sudo chown-R git:git / web/mazey.cn/server/

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report