git创建一个新的仓库(共享库)

服务端:
创建空的仓库(以项目test为例)
lijun@project /home/pm.git $ mkdir test.git
lijun@project /home/pm.git $ cd test.git/
lijun@project /home/pm.git/test.git $ ls
lijun@project /home/pm.git/test.git $ git --bare init --shared
Initialized empty shared Git repository in /home/pm.git/test.git/
lijun@project /home/pm.git/test.git $ ls
HEAD  config  description  hooks  info  objects  refs
lijun@project /home/pm.git/test.git $

客户端:
此时,git clone时可以用其它用户名(因为此时创建的是共享仓库)
lijun@ubuntu:~/Git_clone$ git clone lijunlzu@project:/home/pm.git/test
Cloning into test...
Password:
warning: You appear to have cloned an empty repository.
lijun@ubuntu:~/Git_clone$ cd test
lijun@ubuntu:~/Git_clone/test$ ls
lijun@ubuntu:~/Git_clone/test$ echo "This git storage for test." > README
lijun@ubuntu:~/Git_clone/test$ git add README
lijun@ubuntu:~/Git_clone/test$ git commit -m "init git storage."  README
[master (root-commit) 4d9fe6d] init git storage.
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 README
lijun@ubuntu:~/Git_clone/test$ git pull
Password:
Your configuration specifies to merge with the ref 'master'
from the remote, but no such ref was fetched.
lijun@ubuntu:~/Git_clone/test$ git push origin master
Password:
Counting objects: 3, done.
Writing objects: 100% (3/3), 235 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To lijunlzu@project:/home/pm.git/test
 * [new branch]      master -> master

lijun@ubuntu:~/Git_clone/test$


新的git仓库建立完成!

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值