Git Server Setup

Source: Internet
Author: User
Tags using git

Using SSH to build a remote git repository
1. Log on to the server using SSH to create a repos warehouse directory
2. Create a user group GIT-RW
Groupadd GIT-RW
3. Change the Repos directory group to GIT-RW group permissions
Chgrp-r GIT-RW Repos
4. Add write permission to the Repos group
chmod g+w repos, so as long as the users of the GIT-RW group have write access to the Repos directory
5. Create a user gitteacher and assign it to the GIT-RW group
Useradd-m-G GIT-RW gitteacher//-m parameter is create user, otherwise create default host directory
passwd Gitteacher

6. Create a git repository locally
mkdir Git_teacher
Git init
Touch readme.md
Git add-a
Git commit-m "init git"
7. Return to the parent directory and then clone out of a bare repository
git clone--bare git_teacher git_teacher.git

8. Then copy the cloned warehouse SCP to the remote repository

----
You can initialize an empty warehouse directly above the server
Git init--bare--shared git_server.git


The above is a git operation using an SSH user, now using git public key for git operation
1. Create a git user
Useradd git
2. Switch to a git user
Su git
3. Create the. SSH directory under the GIT host directory
mkdir. SSH
chmod. SSH
Touch Authorized_keys & chmod Authorized_keys

Ssh-keygen Generating private and public keys

Attention:
If you use a public key, you must have git repository write permissions to Git

Git Server Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.