Git常见问题及解决方法

error: file write error (No space left on device)
fatal: unable to write sha1 file
fatal: unpack-objects failed

解决办法:

df -i #查看磁盘占用情况

#删除相关临时文件及日志
sudo rm -rf /tmp/*
sudo rm -rf /var/log/*

git pull时碰到以下情况:

You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull  ').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

    [branch "master"]
    remote = 
    merge = 

    [remote ""]
    url = 
    fetch = 

See git-config(1) for details.

解决办法:

git remote add -f origin git@192.168.21.44:rest.git  
git config branch.master.remote origin  
git config branch.master.merge refs/heads/master 

git放弃本地修改,从远程拉

git fetch --all
git reset --hard origin/master