root@ubuntu:/home/wuzhang/work/gitosis-admin# git add .
root@ubuntu:/home/wuzhang/work/gitosis-admin# git commit -m "add teamwork and user for git server"
[master 51a4055] add teamwork and user for git server
Committer: root <root@ubuntu.ubuntu-domain>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
2 files changed, 9 insertions(+)
create mode 100644 keydir/b.pub
wuzhang@ubuntu:~/work/teamwork_project$ git commit -m "initial version"
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hello.txt
nothing added to commit but untracked files present (use "git add" to track)
wuzhang@ubuntu:~/work/teamwork_project$
添加远端服务器的地址:
root@ubuntu:/home/wuzhang/work/teamwork_project# git remote add origin gitadmin@10.255.13.253:/home/gitadmin/teamwork.git
root@ubuntu:/home/wuzhang/work/teamwork_project# git remote -v
origin gitadmin@10.255.13.253:/home/gitadmin/teamwork.git (fetch)
origin gitadmin@10.255.13.253:/home/gitadmin/teamwork.git (push)
root@ubuntu:/home/wuzhang/work/teamwork_project#
提交文件到服务器:
lroot@ubuntu:/home/wuzhang/work/gitosis-admin# git remote -v
origin gitadmin@10.255.13.253:teamwork.git (fetch)
origin gitadmin@10.255.13.253:teamwork.git (push)
root@ubuntu:/home/wuzhang/work/gitosis-admin# git push -f origin master
gitadmin@10.255.13.253's password:
Counting objects: 9, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (9/9), 1.12 KiB, done.
Total 9 (delta 1), reused 4 (delta 0)
To gitadmin@10.255.13.253:teamwork.git
* [new branch] master -> master
root@ubuntu:/home/wuzhang/work/gitosis-admin#
换个用户,测试下是否可以从服务器克隆刚提交的文件?
切换到另一账户进行git clone测试:
wuzhang@ubuntu:~sugit密码:git@ubuntu:/home/wuzhang
查看服务器的地址:
git@ubuntu:/home/wuzhang/work/teamwork_project$ git remote -v
origin gitadmin@10.255.13.253:teamwork.git (fetch)
origin gitadmin@10.255.13.253:teamwork.git (push)
创建个文件夹,用于存放克隆从服务器获取的文件:
git@ubuntu:/home/wuzhang/work/teamwork_projectcd/gitClone/git@ubuntu:/gitClone git clone gitadmin@10.255.13.253:teamwork.git
fatal: could not create work tree dir 'teamwork'.: ????
git@ubuntu:/gitClone$ git clone gitadmin@10.255.13.253:teamwork.git
出错了,不要怕,应该是权限的问题,我们再试下!