ssh - git push to remote repository "Could not read from remote repository" -
i searched while can't find solution problem.
i have server can connect via ssh username git
, local git repository.
want push local repository newly created 1 on server.
here did:
- created git repository in
/home/git/test.git
- initialized repository bare
- added remote repository on local machine
git remote add test ssh://git@serverip:/home/git/test.git
- now executed push command:
git push test master
i
fatal: not read remote repository please make sure have correct access rights , repository exists.
i working on local windows 7 machine , want upload linux server.
can log in via ssh git
user. tried root
user(to things work once) same result.
never asked ssh password
.
i don't know doing wrong.
before call duplicate, searched lot problem , none seemed talk same problem.
update:
- "which git" returns /usr/bin/git
- path echo includes /usr/bin
- id_rsa , id_rsa.pub files set , withput passphrase
- ssh git@serverip git-receive-pack works , returns /usr/bin/git-receive-pack
- ssh git@serverip ls /home/git/test.git works
- all relevant directories chmod 755
- git owner of repository
- auth.log file gets no new entries on tried push command
- git_trace=2 git push test master returns:
'c:\program files (x86)\putty\plink.exe' '-batch' 'git@serverip' 'git-receive-pack '\''/home/git/test.git'\''' fatal: not read remote repository. please make sure have correct access rights , repository exists.
in case, using openssh on putty key.
original answer (tips debugging)
i can log in via ssh
git
user.
that means works:
ssh git@serverip
you have home
variable defined, , ssh public/private keys (id_rsa
/ id_rsa.pub
) in %home%/.ssh/
.
this question suggests different url:
git remote set-url test git@serverip:/home/git/test.git
make sure did create git repo git (and not root, when created git account, in this question).
ssh git@serverip "which git"
should return path of git executable.
check parent directories have relevant x
(execute) bit set user git
or group gitgroup
, running ls -ld /home /home/git /home/git/test.git
.
also, getting more info git command can done with:
git push --verbose
or:git_trace=2 git push test master
if have private ssh key password, best first test ssh commands private ssh key not password-protected, see if issue persists.
or, can keep password-protected ssh key, double-check .bashrc
in answer.
for ssh connection issue (where git's password needed), check:
/var/log/auth.log
,- an sshd debug session
in case, since works ssh git@serverip
(interactive secure shell), not git (which opens non-interactive secure shell), have @ this thread, references this one:
when ssh started commandline, non-interactive non-login shell started.
however...bash
not use$bash_env
in case, setting in~/.ssh/environment
(e.g./etc/profile
) doesn't help.
bash source/etc/bashrc
,~/.bashrc
.
make sure /etc/profile
define path git
, since non-login account used here (that seems case here, since ssh git@serverip "which git"
worked, , ssh git@serverip "git --version"
should too).
but check right issue, , test chmod 755
on /home
, /home/git
, /home/git/test.git
.
Comments
Post a Comment