Git Pull from Openshift using Windows: Invalid refspec

给你一囗甜甜゛ 提交于 2019-12-21 22:47:11

问题


I created a PHP application on Openshift and successfully SSH into my app. My Git repository on Openshift is similar to this: ssh://1234567890@my_app_name.rhcloud.com/~/git/app_name.git/ . I also created a local Git repository on my computer. I saved my public and private keys here (relative to my local repo): ../ssh/. I named the public and private keys like this: .ssh and .ssh.pub I'm trying to Git pull from my Openshift repo with the following:

git pull ssh:../ssh/.ssh 1234567890@my_app_name.rhcloud.com/~/git/app_name.git/
fatal: Invalid refspec '1234567890@my_app_name.rhcloud.
com/~/git/app_name.git/'

But I'm getting this error fatal: Invalid refspec.

I also tried

git pull ssh://1234567890@my_app_name.rhcloud.com/~/git/app_name.git/

But I got the following error

Permission denied (publickey,gssapi-keyex,gssapi-with-mic). fatal: Could not read from remote repository.

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

How do I pull from Openshift using ssh on Windows?

PS: I created these keys using Git's ssh-keygen -t rsa.


回答1:


You need to define a .ssh/config file which will reference your private key.

Host upstream
    HostName my_app_name.rhcloud.com
    User 1234567890
    IdentityFile ~/.ssh/.ssh

Then use the SCP syntax for ssh url:

git pull upstream:~/git/app_name.git/


来源:https://stackoverflow.com/questions/18906960/git-pull-from-openshift-using-windows-invalid-refspec

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!