1

These are the commands that I've ran on my server:

$ whoami
git

$ ls -l
drwxr-xr-x 3 git  git  4096 Jan 16 05:48 git

$ ls -l git/
total 4
drwxrwxr-x 7 git git 4096 Jan 16 05:55 tpro.git

Then on my local machine:

$ git remote add origin git@gitserver:/opt/git/t.git

Then But when I want to push into the server from my local machine I have the following error:

$ git push -u origin master 
fatal: '/opt/git/t.git' 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.
MLSC
  • 5,872
  • 8
  • 55
  • 89

1 Answers1

1

You mention tpro.git but are trying to access t.git.

Make sure the path exists.
And make sure tpro.git is indeed in /opt/git (not /home/git)

Then try:

git remote set-url origin git@gitserver:/opt/git/tpro.git, 
git push -u origin master

That will ensure master will be pushing to origin/master every time, with a simple git push.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • It refrence me to `fatal: '/opt/git/t.git' does not appear to be a git repository` even I use tpro.git – MLSC Jan 16 '16 at 06:34
  • @MLSC First, does `/opt/git/tpro.git` on your server? – VonC Jan 16 '16 at 06:35
  • Yes ofcourse... the command ` ls -l git/` is ran on /opt directory – MLSC Jan 16 '16 at 06:39
  • @MLSC OK (you didn't include `pwd` in your question, so I had to ask ;) ). Second, can you do a `ssh git@gitserver ls /opt/git/tpro.git`? – VonC Jan 16 '16 at 06:41
  • Yes I have :`branches config description HEAD hooks info objects refs ` – MLSC Jan 16 '16 at 06:46
  • @MLSC looks good! Now: in your local repo, type `git remote set-upstream origin git@gitserver:/opt/git/tpro.git`, and try again this time with a `git push -u origin master`. (not just `git push`) – VonC Jan 16 '16 at 06:47
  • @MLSC What version of git are you using on your local Windows PC? – VonC Jan 16 '16 at 06:50
  • @MLSC Sorry, I meant git remote `set-url`, not `set-upstream` – VonC Jan 16 '16 at 06:51