-1

I created a git environment locally.One system behaves like the server and I created another system as gituser(client).My server repository is a bare repository.I used this $ git clone --bare . ../../remote_repository.git for creating this bare repository.Client made changes and PUSH updated file to remote_repository.But the Server need to view and make update.Thats why I am trying to PULL the file.But I am receiving the below response.Other commands like git status etc are also giving the same response.Since I am a newbie I am very much confused.

Received Response

fatal: Not a git repository (or any of the parent directories): .git

I tried with the below command.I am using ubuntu.

administrator@pramod-desktop:/$ git pull ../../remote_repository.git

Command Explanation

My bare repository path in server is /home/user153/remote_repository.git

../../remote_repository.git:`Path` to my remote_repository.git(git folder)

Anyone please help.

Anshul Goyal
  • 73,278
  • 37
  • 149
  • 186
ROOhhit
  • 1
  • 5
  • Is your "server" repository a *bare* repository? How did you *create* the repositories and why are you trying to `pull` from the "server" it would be more usual for "clients" to `push` to a centralised repository (where one exists). – johnsyweb Nov 05 '13 at 11:37
  • Yeah..my server machine repository is a bare repository.I used this $ git clone --bare . ../../remote_repository.git for creating bare repository.Client made changes and push it to remote_repository.But the Server need to view and make update.Thats why I am trying to pull the file.Other commands like git status etc are also giving the same response.See my updated question.Since I am a newbie I am very much confused.Please help. – ROOhhit Nov 05 '13 at 11:45
  • 1
    @ROOhhit: Questions are editable. Please, edit your comment into the question! – Jan Hudec Nov 05 '13 at 11:54

2 Answers2

1

Pull is an operation that needs two arguments, the repository to pull from and the repository to merge the pulled changes to. The target repository is found from current directory or from special option. When you write:

administrator@pramod-desktop:/$ git pull ../../remote_repository.git
                              ^

Current working directory appears to be /. That definitely isn't a git repository. The synopsis of git pull is:

target-repository$ git pull name-of-source-repository

or

anywhere$ git --git-dir=target-repository pull name-of-source-repository

The target-repository must be a current working directory or must be given using the --git-dir option, but you are trying to pass it as argument.

The name-of-source-repository can be either URL or name of remote configured in .git/config (in bare repository that's just config).

If you want to check the file out on the server (indeed rather common operation), you should create another, non-bare clone. Than you need to call the git pull from that clone.

Jan Hudec
  • 73,652
  • 13
  • 125
  • 172
  • I am receiving the same error while running administrator@pramod-desktop:/$ git status.ie no git command is working . – ROOhhit Nov 05 '13 at 12:25
  • @ROOhhit: Of course you are. Because _all_ git commands (well, most) need to be executed inside repository or work tree. And root directory is not one. – Jan Hudec Nov 05 '13 at 12:26
  • Jan Hudec:Here my bare repository path is (remote_repository.git-cloned from/home/user153/workspace/repo02) /home/user153/remote_repository.git.so I used this command to get status.administrator@pramod-desktop:/home/user153$ git status .this also showing the same error.Will you please point out where I went wrong. – ROOhhit Nov 05 '13 at 12:33
  • @ROOhhit: The current working directory must be the directory that contains `.git` subdirectory. It still isn't. By the way, your comment is almost unintelligible; please take more care placing spaces on the correct side of punctuation marks and use backticks around literal strings. – Jan Hudec Nov 05 '13 at 15:02
  • Jan Hudec:I used this command : administrator@pramod-desktop:/home/user153 $ git pull ../../remote_repository.git.My .git folder is in /home/user153. – ROOhhit Nov 06 '13 at 03:52
0

Try this :

administrator@pramod-desktop:/home/user153/workspace/repo02$ git pull ../../remote_repository.git

Here /home/user153/workspace/repo02 is the working folder where .git is resided in your case.

Sonya Krishna
  • 269
  • 1
  • 11