git仓库服务器SSH认证示例
# useradd -d /opt/gitServer gitServer# echo "gitServer" |passwd --stdin gitServer
更改用户 gitServer 的密码 。
passwd: 所有的身份验证令牌已经成功更新。
# su - gitServer
# git clone gitServer@192.168.100.128:/opt/gitServer/TestProject.git
Initialized empty Git repository in /root/TestProject/.git/
The authenticity of host '192.168.100.128 (192.168.100.128)' can't be established.
RSA key fingerprint is 9f:32:3a:b0:db:03:b6:c8:fc:a0:47:6c:e5:d1:b0:6a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.100.128' (RSA) to the list of known hosts.
gitServer@192.168.100.128's password:
warning: You appear to have cloned an empty repository.
# ls
anaconda-ks.cfginstall.loginstall.log.syslogTestProject
# cd TestProject/
# echo "test file" > test.file
# git add test.file
# git config --global user.name "gitServer"
# git config --global user.email git@lansgg.com
# git commit -m "test commit" test.file
test commit
1 files changed, 1 insertions(+), 1 deletions(-)
$ git remote add test_remote_origin ssh://192.168.100.128/opt/gitServer/TestProject.git
$ git push test_remote_origin master
gitServer@192.168.100.128's password:
Counting objects: 5, done.
Writing objects: 100% (3/3), 252 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To ssh://192.168.100.128/opt/gitServer/TestProject.git
7e2e4a4..96bf273master -> master
页:
[1]