7

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?

BeetleJuice
  • 33,709
  • 16
  • 78
  • 137

1 Answers1

5

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.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • I did my first commit locally. I wrote so in the OP, just above step 1. Am I not allowed to have any untracked files? Re: Second: 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. – BeetleJuice Sep 18 '15 at 11:33
  • 1
    Thanks. I ran `git --version` on the server. Version is 1.8.3. I'll look into how to upgrade git, then test my initial steps again. – BeetleJuice Sep 18 '15 at 12:05
  • @Patrick I confirm: 1.8.3 won't support `updateInstead` for the `receive.denyCurrentBranch`. – VonC Sep 18 '15 at 12:06
  • After upgrading git on the server to 2.4, things worked as expected. My initial problem is that I did not realize that git was also running on the server. I thought local git was controlling everything. – BeetleJuice Sep 18 '15 at 13:44
  • @Patrick git is purely a local filesystem manager (able to manage the history of files). Unless you access the server through a shared path, you would need another git to execute git command on the server side. – VonC Sep 18 '15 at 13:46