首页 > 代码库 > git服务端问题解决 fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.
git服务端问题解决 fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.
=====
下面的解决办法,可能只是适用于我遇到的这种情况,又想做钩子,又想恢复原先老人们配置的git的正常使用。
=====
因为是以前离职的员工配的,所以先检查一下原来的git能能正常使用不:
1、只有一条分支 master
2、版本库和项目目录是同一个,即
git clone root@www.xx.com:/home/project
生产服务器上的项目目录也是: /home/project
=> 不知道 他们这么配的道理是什么。
3、在生产服务器上,执行 git pull,报告如下错误:
remote name from which new revisions should be fetched.
4、配置文件 .git/config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
quotepath = false
[receive]
denyCurrentBranch = ignore
==========================================
解决方案:
1、给项目文件夹的提高权限
chmod -R 777 /home/project
2、修改 .git/config文件
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[receive]
denyCurrentBranch = ignore
denyNonFastForwards = false
3、进入.git/hooks/
=》git钩子,百度有很多,但可能不适用我这边的情况。
放入一个 文件,文件名: post-update
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
cd ..
env -i git reset --hard
=======================
结果:
我在本地提交,生产服务器上的项目文件夹里的文件目录也起变化了,钩子也成功。
git服务端问题解决 fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.