git push提示Read-only权限问题

今天git push时出现如下错误:


$ git push

warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

In Git 2.0, Git will default to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

git@xxx.com's password:
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 322 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
error: unable to create temporary sha1 filename ./objects/e3: Read-only file sys
temerror: unpack failed: unpack-objects abnormal exit

fatal: failed to write object
To git@xxx.com:~/your-repositoryname.git
 ! [remote rejected] master -> master (n/a (unpacker error))

error: failed to push some refs to 'git@xxx.com:~/your-repositoryname.git


根据错误提示知道,这是git库权限问题,解决办法如下:

1、首先在远程服务器上试试看,用mkdir能不能新建目录,

[root@www.xxx.com]:~# mkdir aa
mkdir: cannot create directory `aa': Read-only file system

如果提示 Read-only file system,可以尝试用 fsck -y 来修复



[root@www.xxx.com]:~# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
proc            /proc           proc    nodev,noexec,nosuid 0       0
# / was on /dev/xvda1 during installation
UUID=8f91cd21-b0ca-45d7-88ba-616ddc4d37ec / ext4 errors=remount-ro,barrier=0 0 1
none                   /proc/xen               xenfs   defaults        0 0
/dev/xvdb1 /mnt ext3 barrier= 0 0 0

[root@www.xxx.com]:~# fsck -y
fsck from util-linux 2.20.1
e2fsck 1.42 (29-Nov-2011)
/dev/xvda1 contains a file system with errors, check forced.
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
Inode bitmap differences:  -400460
Fix? yes

Free inodes count wrong for group #48 (4, counted=5).
Fix? yes

Free inodes count wrong (1228211, counted=1228217).
Fix? yes


/dev/xvda1: ***** FILE SYSTEM WAS MODIFIED *****
/dev/xvda1: ***** REBOOT LINUX *****
/dev/xvda1: 82503/1310720 files (0.2% non-contiguous), 649348/5242368 blocks


[root@www.xxx.com]:~# reboot

重启后就能正常push了


2、如果在服务器终端使用mkdir能创建目录,说明仅仅是git仓库权限出现了问题,使用如下命令就可以解决:

chomod -R 777 your-repositoryname.git


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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值