Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
539 views
in Technique[技术] by (71.8m points)

linux - How to setup and clone a remote git repo on Windows?

Anybody know how to checkout, clone, or fetch project or code from a git remote repository on a Windows server?

Repository IP is: xxx.xx.xxx.xx, source file directory is c: eposproject.git

I am used to the command line interface from a SUSE Linux terminal. I have tried the same kind of method but it always replies that

fatal: ''/repo/project.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

Can anyone tell me how to setup and clone?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You have to set up some kind of sharing from the windows machine, that you can access with git. Git supports 3 access methods: ssh, remote filesystem or http. The last one is probably most complicated, so I won't detail it. The first two are:

  1. Set up ssh server on windows.

    You can try this guide: http://www.timdavis.com.au/git/setting-up-a-msysgit-server-with-copssh-on-windows/. See also this question for some more options.

    Than you clone by git clone username@xxx.xx.xxx.xx:/c/git/path/to/repo (you will be asked for password).

    Advantage of this method is that it's secure (connection is encrypted and ssh server is trustworthy), so you can use it over internet. Since git server is running on the windows machine during access, you can set up hooks for advanced security policy, controlling other processes and such.

  2. Share the repository using windows sharing.

    Than on the linux host, you need to mount the share with smbmount. That might require username and password, depending on how you set the permissions.

    Than you clone by git clone /share/mountpoint/path/to/repo.

    This is probably easier to set up, but it is not very secure, so it shouldn't be used outside local network. Also in this case hooks on the windows machine won't be executed (in fact git will try to execute them on the Linux machine, but they either won't run there or can be bypassed anyway), so you can't apply advanced security.

A particular file is not relevant, you need to give path to the directory containing .git subdirectory or to the directory that is a bare repository (path/to/repo above).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...