Git receive.denyCurrentBranch更新而不是失败 [英] Git receive.denyCurrentBranch updateInstead fails

查看:64
本文介绍了Git receive.denyCurrentBranch更新而不是失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是git的新手,没有任何版本控制系统的经验.我在本地开发,正在寻找一种比FTP更简单的方法来将文件部署到(LAMP)Web服务器.我很难配置Git(适用于Windows的2.5版)在推送更改时自动更新其当前工作目录.创建本地存储库,执行第一次提交并在别名origin下添加远程位置后,这就是我所做的事情:

  1. [远程] ssh user@domain
  2. [远程] cd testgit
  3. [远程] git init
  4. [远程] git config receive.denyCurrentBranch updateInstead
  5. [远程] git status:无需提交
  6. [远程] exit
  7. [本地>>主用户] git status:未添加任何内容,但存在未跟踪的文件
  8. [本地>>主用户] git push origin master

第8步产生一个通知和两个错误:

  • stdin: is not a tty
  • fatal: bad config value for 'receive.denycurrentbranch' in config
  • fatal: Could not read from remote repository

我一直在四处张望,但被困住了.我在做什么错了?

解决方案

首先,您需要先添加并提交,然后再进行推送:如果您有未跟踪的文件,那么在您进行添加并提交之前不会进行推送.

第二,"receive.denyCurrentBranch updateInstead"; 仅适用于git 2.3+(2015年2月):确保服务器端具有正确的git版本.

应该在服务器上单独安装git吗?我的Windows机器上有git 2.5.我没有在服务器上专门安装任何东西

是的,您还需要在服务器上安装git.

I'm brand new to git and have no experience with any version control system. I develop locally and am looking for a simpler way (than FTP) to deploy files to the (LAMP) web server. I am having a hard time configuring Git (version 2.5 for Windows) to automatically update its current working directory when I push changes. Here is what I've done, after creating a local repo, doing the first commit, and adding the remote location under alias origin:

  1. [remote] ssh user@domain
  2. [remote] cd testgit
  3. [remote] git init
  4. [remote] git config receive.denyCurrentBranch updateInstead
  5. [remote] git status: nothing to commit
  6. [remote] exit
  7. [local >> master] git status: nothing added but untracked files present
  8. [local >> master] git push origin master

Step 8 generates one notice and two errors:

  • stdin: is not a tty
  • fatal: bad config value for 'receive.denycurrentbranch' in config
  • fatal: Could not read from remote repository

I've been looking around but I'm stuck. What am I doing wrong?

解决方案

First, you would need to add and commit before pushing: if you have untracked files, then won't be pushed until you do add and commit.

Second, "receive.denyCurrentBranch updateInstead" is only for git 2.3+ (February 2015): make sure you have the right version of git n the server side.

Should git be installed separately on the server? I have git 2.5 on my Windows machine. I did not install anything specifically on the server

Yes you need to have git on the server as well.

这篇关于Git receive.denyCurrentBranch更新而不是失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆