Subversion over ssh - access to the remote repository on Linux from Windows host - linux

I created a repository in Mandriva Linux and want to access it from Windows host.
mkdir /home/user/myrepo/
svnadmin create /home/user/myrepo/
To do this, i installed a client TortoiseSVN 1.7.9.
I set the path -
svn+ssh://user#ip/home/user/myrepo/
Where ip== ip of remote linux host.
I'm trying to do a review of the repository, but get an error -
Unable to connect to a repository at URL 'svn+ssh://user#ip/home/user/myrepo/' Can't create tunnel.
What could be the reason for the error?

You need to edit your configuration file (%appdata%\Subversion\config), there is a section called tunnels where you have an out commented line like this:
ssh = C:\\Program Files\\TortoiseSVN\\bin\\TortoisePlink.exe
If you use a key for authorization you can add this parameter for skipping the password entry part:
-i c:\\Path\\to\\putty-ssh-key.ppk

Related

Git clone gives "ssh: connect to host github.com port 22: Connection timed out" Linux /opt directory Amazon EC2 Instance

Issue
I am trying to use git in /opt/jamf2snipe directory on an EC2 Instance. I have tried the following command:
sudo git clone git#github.com:MYUSERNAME/jamf2snipe-school.git
It says connection timed out:
Cloning into 'jamf2snipe-school'...
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
If I try to run this in my home directory it works fine. It seems to be a permission issue with /opt. I am wary of changing permissions for /opt.
Setup
I am trying to do this on an Amazon EC2 Instance. Currently SSH is limited to certain IP addresses (not including Github). I followed this article from github to use SSH over HTTPS. I tested to make sure I had stuff setup correctly by using:
$ ssh -T git#github.com
received
Hi USERNAME! You've successfully authenticated, but GitHub does not provide shell access.
I did this in /opt/jamf2snipe and the home directory successfully.
First, make sure to, if possible, not use sudo.
In addition of executing commands as root (which is dangerous), it uses its own environment variable, and SSH settings (in /root/.ssh), which differs from your normal EC2 user.
Conversely, making a repository in /opt, which might be accessible only by root, is not the best spot to clone a repository.
Second, Using SSH over the HTTPS port is the usual solution (like this one from 2018) on EC2, where the firewall can block by default SSH egress traffic.

Git not storing credentials when sshed into server

I have a ubuntu VM which I SSH into from a windows machine to develop on. I have my windows pub key on the linux VM so I can ssh without password.
On the linux machine I have set to store my git credentials. When I do any git command on the VM directly, it is able to use the stored credentials and carries out the given task. However, if I ssh into the VM from windows, and try to do any git command, it never stores the credentials and each time I have to reenter the password.
What is causing this and is there a way to fix it?
Compare the output of git config --show-scope --show-origin credential.helper when:
you are logged in directly on the Linux server
you are logged in through SSH from Windows
This assumes that, in both instances, you are using an HTTPS URL from your Linux server when using git clone/push/pull to a remote server.
If the Git on Linux is not recent enough, use simply git config --global credential.helper.

Subversion svn+ssh access and prohibit copying files from server via SSH

System environment :
Server: Centos 6.2
Client: Windows + TortoiseSVN + putty
I have installed subversion in centos, created repository on server, and configured svn+ssh access way using key authentication. Everything works fine.
But I have a question about svn user using svn+ssh mode.
The svn user have a ssh key, so he can access subversion server and of course he can also access Centos server by SSH using the key authentication. Further, he can copy subversion repository files(Specifically /db files) from centos server using like WinSCP tool base on SSH.
So, I wanna know if there is a way that let the svn user just can access svn repository via svn+ssh and can't copy repository files from centos directly via ssh accessing?
If he can copy repository files from centos server via ssh, I think the svn access control realized by conf/authz file doesn't make any sense and svn repository isn't safe.
I just learn how to create a svn+ssh subversion server, so maybe my knowledge isn't enough, please give me a idea or just tell me whether a solution exists.
If can't prohibit copying files from Linux server via SSH, I will use svn or http(s) access mode.
Thank you!
I found a way to solve this problem.
add command into authorized_keys file to disable ssh shell login and scp, but enable svn+ssh, like this:
"/usr/bin/svnserve -t -r /svn/test/",no-port-forwarding,no-pty,no-agent-forwarding,no-X11-forwarding
after add your authorized_keys file will like this:
command="/usr/bin/svnserve -t -r /svn/test/",no-port-forwarding,no-pty,no-agent-forwarding,no-X11-forwarding ssh-rsa A......................................................................
I think this is one solution, do your have others? Please let me know.

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:\repos\project.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?
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:
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.
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).
First of all, the git repository is just a bunch of files you need to access. You wrote about cloning and fetching repository, and this is easy part - you just need to access the files (and have read rights).
It can be done by direct access to filesystem, by http(s) protocol, or by ssh connection. Actually, there is even a way to do it by ftp server.
What you can do:
1) set the ssh server, then access the git files via ssh server - actually, the path you should use depends on the ssh server you use on windows: source
2) set the web server to access the file:
git clone http://host/path/to/repo
3) mount filesystem from windows on your linux machine and clone repo:
git clone /mnt/filesystem/path/to/repo
Despite the method you choose I suggest to consult the apropriate chapter from Pro Git Book

Clone TFS-GIT repository to GIT repository (Linux) by using GIT

We have Redhat Linux server, GIT was already installed on this server and we need to create a local repository.
We have TFS-GIT project in TFS 2015, we need to clone the TFS-GIT repository to the GIT repository on Linux by using GIT commands.
For this task, we created a empty local repository on Linux, and configured the basic authentication and configured the SSL certification by using server manager.
Still getting "Fatal: authentication error" to connecting TFS-GIT repository on windows server 2012 . We tried in different ways but still we are getting same error.
Am using my basic credentials like which I used for server logins and I have only id and password for everything.
Is there any specific kind of passsord I need to use for this?
Please advise me on this
Thanks in advance
You have done all as it should be.
You need to copy your public key of the desired user to the Unix server as well so it will work.
How to setup ssh-key?
# generate the key (local machine)
ssh-keygen -t rsa
# copy the generated key to your unix machine (server)
# the key is in : %HOME%/.ssh/id_rsa.pub
# In widows its under your user account: Users/<user_name>
Other ways
If you have only username and password you might need to use http/https.
Read here how to set it up/

Resources