雪痕的 git 使用笔记

1.仓库问题

github中新建仓库 clone至本地后,删除github 上的仓库 ,再次新建同名仓库,在本地提交会出现:

To https://github.com/yourname/Interview.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/yourname/Interview.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

本地仓库和GitHub上的仓库会被认为两个独立的仓库,可使用如下命令解决:

$ git pull origin master --allow-unrelated-histories
2.私搭仓库

在linux上使用

sudo git init --bare example.git

建仓
结束后在本地clone ,添加文件,add commit push 后想在服务器上找到提交的文件,没找到,网上查阅后,得知,使用–bare参数时,服务器此仓库只是负责记录提交记录的和元数据,不记录提交文件,想在服务器上查看文件,可以找一个喜欢的文件夹,使用

git clone /you/repository/path
cd youdir
git pull

然后就可以看到提交的文件了

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值