In a world:
A you should in your VPS you add gitUser
Log into your VPS, and gain root*:
su -
*Some people feel uncomfortable using root in this manner. If your VPS is set up to use sudo, then do so.
Add the Unix user (not necessarily Git user names) to handle the repositories:
useradd git
Then give your Git user a password:
passwd git
B Then you should in the /home/git in yout VPS
create your git repo
you can input this command:
git init --bare test.git
C in yout local PC
you just create ssh, and you need send the id_rsa.pub key send to admin manager!
Then
you create the directory, where you want to create git repo:
git clone git@IP:/home/gitA/hades.git
MayBe you need meet this quesiton: in the terminal command:
Permission denied, please try again?
Why? because your VPS git user directory remote user have no permission
you just use this command :
cd /home/git
chmod 777 git -R
It works for me!
D Now, you will meet this question you always should input password when you git pull or push!
Why ?
I have set id_rsa.pub to the .ssh/authorized_keys
But it doesn't work for me? why?
E how to control many people?
How To Use Gitolite to Control Access to a Git Server on an Ubuntu 12.04 VPS
F How to look your VPS version system info?
cat /etc/issu
========================================================================
1 when you use this command line
git clone git@IP:home/git/hadesgit.git
error info:
git clone git@103.21.140.1:/repo/test.git
Cloning into 'test'…
fatal: '/repo/test.git' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
一般是因为你的路径填写的有问题,所以需要做的就填写对的路径
git clone git@Ip:/home/git/hadesgit.git
========================================================================
2 当你的VPS 配置的端口,有可能你把常用的端口给禁掉了,并不是
22 端口的时候
如果你的git服务端改了非默认端口,那么客户端指定端口连接有以下两种办法:
--------------------------------------------------------------------------------------
方法一:(仅linux系有效) 做ssh端口映射
编辑 ~/.ssh/config
host example.com
port 6789
.git/config里的地址
url = git @example.com:test.git
当进行远程访问的时候,ssh连接会将example.com的端口指向6789
========================================================================
3 error: insufficient permission for adding an object to repository database ./objects
========================================================================
4 Permission denied, please try again?
5 you how to config git config file?
git config --global user.name "Your Name"
git config --global user.email you@example.com
============================================================================
Reference Links:
1 if you meet git clone git@45.78.17.86:home/git/hadesgit.git
http://yikebocai.com/2013/11/build-private-git-server/
2 How to set git repo in the VPS ?
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps
http://intermarketing.merkados.com/setup-a-git-repository-in-your-vps
3 按照这个流程基本能走通。已测试~
还是看中文的舒服,我也是罪恶了!
http://www.alliedjeep.com/8481.htm
============================================================================
Reference:
https://www.digitalocean.com/community/tutorials/how-to-set-up-a-private-git-server-on-a-vps
No comments:
Post a Comment