IOS builds git server on Mac OS

Source: Internet
Author: User

Objective:

Before learning how to use Git, has been trying to build a native to build a git server, at first did not know to go a detour with the gitosis, tossing me for several days have not been configured well. Last night, the data found that gitosis long ago, the update is slow to replace the gitolite. Later in the view gitosis and Gitolite found this article, in fact, if the permission requirements are not high, do not need to install gitosis, Gitolite,gitlab and other management software, so early in the morning to start research, and finally succeeded.
Reference article 1
Reference Article 2
First, create a standard new user named Git.

"root ALL=(ALL) ALL""AccountName ALL=(ALL) ALL"ALL=(ALLALL)并保存。

Second, client side, set to

Third, verify if you can connect to the GIT user

$ ssh [email protected]# Are you sure you want to continue connecting (yes/no)? yes# Password: # Last login: Fri Jan  3 09:00:55 2014# exit

Iv. using SSH RSA public key

1) If the client has already created an SSH RSA public key, execute 2), or create the following first:

$ cd ~$ ssh-keygen -t rsa  # 默认存放路径 ~/.ssh/id_rsa.pub

2) Copy the SSH RSA public key to the server side (the Id_rsa.pub file can be renamed when it is created.) You can also copy the ~/.ssh/id_rsa.pub to another place and rename the CP ~/.ssh/id_rsa.pub/tmp/yourname.pub.

$ ssh [email protected]Name.local.ssh  # 登陆 server 并创建 .ssh 文件夹$ scp ~/.ssh/id_rsa.pub [email protected].local:.ssh/authorized_keys# id_rsa.pub                                    100%  405     0.4KB/s   00:00  

3) Modify the server-side sshd_config

666 sshd_config$ vi sshd_config#PermitRootLogin yes     改为 PermitRootLogin no# 下面几项把前面的 #注释 去掉#RSAAuthentication yes#PubkeyAuthentication yes#AuthorizedKeysFile     .ssh/authorized_keys#PasswordAuthentication no#PermitEmptyPasswords no#UsePAM yes          改为 UsePAM no# exit

After the above steps have been configured, the following to test:
1) Create an empty repository on the server side

$ cd path/to$ mkdir newrepo.git$ cd newrepo.git$ git init --bare# --bare flag 只是用来存储 pushes,不会当做本地 repository 来使用的。

2) on the client side, create the local repository and push

$ cd path/to$ mkdir newrepo$ cd newrepo$ git init$ README$ git add .$ "initial commit"$ git remote add origin git@yourComputerName:/path/to/newrepo# 如果直接之前在 server 端创建的 newrepo.git 是在 home 目录,则这里地址为:git@yourComputerName:newrepo.git$ git push origin master

IOS builds git server on Mac OS

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.