码迷,mamicode.com
首页 > Web开发 > 详细

git服务端问题解决 fatal: No remote repository specified. Please, specify either a URL or a remote name from which new revisions should be fetched.

时间:2017-06-14 12:54:16      阅读:732      评论:0      收藏:0      [点我收藏+]

标签:one   mat   ref   ranch   for   log   项目   form   git pull   

=====

下面的解决办法,可能只是适用于我遇到的这种情况,又想做钩子,又想恢复原先老人们配置的git的正常使用。

=====

因为是以前离职的员工配的,所以先检查一下原来的git能能正常使用不:

1、只有一条分支 master

2、版本库和项目目录是同一个,即

git clone root@www.xx.com:/home/project

生产服务器上的项目目录也是: /home/project

=> 不知道 他们这么配的道理是什么。

3、在生产服务器上,执行 git pull,报告如下错误:

 fatal: No remote repository specified.  Please, specify either a URL or a
remote name from which new revisions should be fetched. 
=》百度上面的报错,线上有很多同样的解决方案,但可能不是我想要的。
且我在本地创建的文件1.txt和2.txt文件,在master上git add. , git commit -m "xx",git push,到了生产服务器上就变成:
使用git status查看状态:
绿色的:
deleted 1.txt
deleted 2.txt 
=》这个是不正常的,我明明是提交了两个新文件,但是生产服务器上是提示我要删除掉这两个文件。隐隐感觉,可能跟权限有关系。所以,我把项目文件夹权限改为777,再去git status就不会出现这种情况。

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.

标签:one   mat   ref   ranch   for   log   项目   form   git pull   

原文地址:http://www.cnblogs.com/meiping/p/7007876.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!