Solucionado (ver solução)
Solucionado
(ver solução)
9
respostas

Git not apper to be a git repository

Boa noite, tudo bem?

Estou tentando seguir a aula, porém quando tento puxar os dados do servidor da o seguinte erro.

André@DSK-PCSSD0001 MINGW64 ~/Desktop/git-github (master)
$ git push local master
fatal: 'C:/desktop/git-github/servidor' does not appear to be a git repository
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
9 respostas

Olá, André.

A pasta C:/desktop/git-github/servidor existe? Se sim, você executou o comando git init --bare nela?

André@DSK-PCSSD0001 MINGW64 ~/Desktop/git-github/servidor (master)

Sim, ele esta dentro da pasta git-github e até tem vários arquivos dentro dele, porém quando faço isso uso o git clone da o erro.

usando o git remove -v aparece isto

André@DSK-PCSSD0001 MINGW64 ~/Desktop/git-github (master)
$ git remote -v
local   C:/desktop/git-github/servidor (fetch)
local   C:/desktop/git-github/servidor (push)

Dei uma olhada no stackoverflow e tentei usar git push servidor master

e deu a seguinte mensagem.

$ git push servidor master
Enumerating objects: 21, done.
Counting objects: 100% (21/21), done.
Delta compression using up to 4 threads
Compressing objects: 100% (17/17), done.
Writing objects: 100% (21/21), 2.13 KiB | 728.00 KiB/s, done.
Total 21 (delta 4), reused 0 (delta 0), pack-reused 0
remote: error: refusing to update checked out branch: refs/heads/master
remote: error: By default, updating the current branch in a non-bare repository
remote: is denied, because it will make the index and work tree inconsistent
remote: with what you pushed, and will require 'git reset --hard' to match
remote: the work tree to HEAD.
remote:
remote: You can set the 'receive.denyCurrentBranch' configuration variable
remote: to 'ignore' or 'warn' in the remote repository to allow pushing into
remote: its current branch; however, this is not recommended unless you
remote: arranged to update its work tree to match what you pushed in some
remote: other way.
remote:
remote: To squelch this message and still keep the default behaviour, set
remote: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
To servidor
 ! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'servidor'

A pasta esta dentro do diretório, porém continua acusando que não tem o arquivo.

$ git remote remove servidor
fatal: No such remote: 'servidor'

Você não tem um remote chamado servidor. Seu remote se chama local.

Acessa C:/desktop/git-github/servidor e dá um git status lá. Vê se realmente está configurado corretamente.

Não sei se o Windows diferencia letras maiúsculas de minúsuclas, mas seu Desktop está minúsculo no remote e maiúsculo na estrutura de pastas.

Dando um status na pasta do servidor, fica da seguinte forma.

André@DSK-PCSSD0001 MINGW64 ~/desktop/git-github/servidor (master)
$ git status
On branch master

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        HEAD
        config
        description
        hooks/
        info/

nothing added to commit but untracked files present (use "git add" to track)

é como se ele fosse uma pasta comum pelo visto.

Fala, André.

Você não inicializou esta pasta com o comando git init --bare. Se tivesse, a mensagem retornada pelo git status seria:

fatal: this operation must be run in a work tree

Apague essa pasta servidor, crie uma nova, vazia. Execute git init --bare nela. Aí tudo deve funcionar.

Ok, refiz isso e dei uma organizada nas pastas e voltou a funcionar, mas tenho outro erro agora. Perdão por tantas perguntas

O servidor iniciou certinho e tudo mais, só que ao usar git remote na pasta da Ana, nada aparece.

André@DSK-PCSSD0001 MINGW64 ~/documents/git-e-github/andre (master)
$ git push local master
Everything up-to-date

André@DSK-PCSSD0001 MINGW64 ~/documents/git-e-github/andre (master)
$ cd ..

André@DSK-PCSSD0001 MINGW64 ~/documents/git-e-github
$ cd ana

André@DSK-PCSSD0001 MINGW64 ~/documents/git-e-github/ana
$ ls
servidor/

André@DSK-PCSSD0001 MINGW64 ~/documents/git-e-github/ana
$ git remote
fatal: not a git repository (or any of the parent directories): .git
solução!

Seu repositório git referente à Ana está dentro da pasta ana/servidor. Só entrar nessa pasta e ser feliz.

:-D

Perfeito! Muito obrigado e desculpa.

Não precisa se desculpa r, André. Estamos aqui pra ajuda. :-D

Abraços e bons estudos.