svn/ssh question in windows - windows

I am trying to do a command line svn update on my windows machine (to use in a batch file), and I want it to emulate what my settings are in the Tortoise SVN GUI.
In the tortoise settings, we have to specify the following in the SSH client...
C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe -l usernamehere -pw mypassword -i C:\Users\Mike\Documents\myprivatekey.ppk
and I simply right click update...
does anyone know how I would use the svn.exe to emulate the above? (using plink with a private key?)
If I am not clear on something please comment and I will work it out.
Best,
Mike

svn+ssh command line
Basically,
Edit the file c:\Documents and Settings\user\Application Data\Subversion\config
Locate the section named [tunnels]
Add the following line : ssh=c:/path/to/plink.exe -i c:/path/to/your/key.ppk

I couldn't get subversion to work with plink, so I used Git's SSH. Details on my wiki at http://wiki.dandascalescu.com/howtos/subversion/subversion_access_through_ssh_on_windows.

Related

How to deploy my website with one click using Git Bash on windows and a scripted command

I have a html/css/js website which is stored in GitHub and developed on my Windows 10 machine using Visual Studio 2019.
Currently I'm deploying it using the Git Bash console and then running a git ftp command to push any deltas to the server.
Specifically:
I have pinned shortcut on the task bar which opens Git Bash in the root directory of the website.
Once the console has opened, I execute the following command to push to the server: "git ftp -v -u "frankray" push"
A two click deployment is no big deal, but I'd really like to do this in one click from the task bar (as a prelude to automating the CI).
Problem: I cannot for the life of me workout how to pass in the git ftp command into the console and run it, say from a batch file or perhaps directly calling git-bash.exe with the command passed in as a parameter.
I can't imagine it's hard to do, but I haven't worked out what I've been doing wrong. Please help.
Posting my comment as an answer
Unfortunately there isn't a list of command line options for git-bash. This superuser question may provide some more info.
A possible solution (verified by OP) is passing the -c parameter (command to be executed) to the target like so;
"C:\Program Files\Git\git-bash.exe" --cd="C:\Users\frank\Documents\Professional\Contracting\5. Frank Ray & Associates Ltd\Website\frankray.net" -c 'git ftp -v -u "frankray" push ; read -p "Press any key to continue"'

svn hangs on checkout in Windows

Attempting to check out a repository using svn checkout svn+ssh://USER#REPO .
I have set my %SVN_SSH% variable to include the -v flag when calling plink.exe, and the last log I get is Using username "USER". After that the command line hangs indefinitely.
I get similar problems attempting to checkout the repository using TortoiseSVN and the Subversion integration in Intellij.
I have no problems connecting to the server using PuTTY or calling plink directly in the command line. Using the -v flag with plink, I get prompted for my password immediately after the line where it hangs using svn checkout.
I have Windows 7 Ultimate SP 1, svn version 1.8.13, plink release 0.60.
The problem seems to be that you have to use public key authentication for SVN to be able to use SSH in Windows properly.
There are a few tutorials online for how to do this, but the one that worked for me was this one.
The important difference, which I didn't find in other tutorials, was the usage of the chmod command to change access permissions to the public key file on the server.
It might be too late to say, but i've had the similar problem.
In mine case the issue was in the command line of the plink.exe.
To properly fix all issues and do not type infinite logins and passwords:
Use pageant.exe to add the ppk key and avoid manual input of the password.
Use SVN_SSH environment variable with the -l "<username>" parameters to avoid manual input of the user name and avoid usage the username in the svn repository url.
Use SVN_SSH environment variable with the -batch parameter to avoid hangs in a script mode.
The resulting SVN_SSH environment variable should look like this:
SVN_SSH="<path-to-plink>/plink.exe" -batch -l "<USER>"
warning: backslash character in a path in the SVN_SSH variable is an escape character, you have to use a double to self escape it or replace it a forward slash - /.
But be careful with the git svn command, because the SVN_SSH variable can break the git with the message:
Can't create session: Unable to connect to a repository at URL 'svn+ssh://...': Error in child process: exec of '' failed: No such file or directory at .../Git/mingw64/share/perl5/Git/SVN.pm line 310.
In that case you have to use the ssh-pageant from the msys or cygwin tools instead.
I've create another post with detailed description on how to do that step by step both for the svn.exe and git.exe: How to use git-svn with svn+ssh url

Anyone know how to put a Cygwin term in the context menu

I would like to put a Cygwin terminal menu item on a Windows 7 context menu.
But I would like the shell to open at the folder.
chere -i is supposed to do something like it but ends up giving a bash shell that does NOT have my profiles loaded.
Anyone know how to acheive this?
You can try chere -i -t mintty. It worked for me, as it defines which terminal type to bring up, and in my case, (I'm running 64 bit windows 7) mintty seems to load my profiles.
Since you have already tried chere -i, you have to uninstall it first, using chere -u, then run the above command chere -i -t mintty.
Bare in mind, that on my work laptop, I had to run cygwin as administrator for this to work (I believe chere modifies the registry at some point). But it worked on my home PC flawlessly without administrator privileges.
Other people also claim some success following this blog post, http://with-love-from-siberia.blogspot.co.uk/2013/12/cygwin-here.html which shows how to use a windows batch file to modify the registry to add the option to the folder context menu.

PuTTY run sh can't install fileinfo extension

I have a DreamHost server, and I would like to install the fileinfo extension.
I managed to create a custom php.ini file that's cool, but I'm totally stuck at this part in their documentation:
Please make sure to run 'dos2unix fileinfo_ext.sh' from the shell if you use a Windows-based editor to create this file.
So I am on Windows and running PuTTY and I have no clue about this part.
I copied fileinfo_ext.sh to my cgi-bin directory where my custom php.ini file is, but how do I go further? I'm totally lost how to run this command.
How can I do it?
"dos2unix" is a utility used to convert file from Windows line endings (CR+LF) to Unix line endings (LF).
So if you use Notepad to edit the file it will have Windows line endings. So dos2unix should be used on your computer (for that file) before sending it by FTP (or executing it on the host if you have ssh access and they have dos2unix).
But if you already use an editor which supports converting to Unix line endings, like UltraEdit or Notepad++ then all you need is to do a "convert to Unix" before saving the file.
You run the command as explained in the message. SSH to the server and login. Then cd to the location of the file, something like cd /path/to/your/site/cgi-bin and then run dos2unix fileinfo_ext.sh.
I hope this helps.

Open a file from Cygwin

Is there an equivalent to OSX open command in cygwin. open opens a file with the default application for that type.
I want to do something like
$ magic-command file.xls
#excel opens as if file.xls would have been double-clicked
$ magic-command file.txt
#notepad opens as if file.txt would have been double-clicked
You get the idea?
Basically something like a "cygwin-double-click" command.
You can also use the cygwin utility:
cygstart <your file>
To make things OSX-like add the following to your bashrc
alias open='cygstart'
Don't forget to check out the man page for cygstart.
You can use the start command from the CMD like this:
cmd /c start <your file>
explorer <your file>
works too. What is nice is
explorer .
opens a windows explorer window in the current directory. But then
cygstart .
does the same thing and does more, but I find 'explorer' slightly easier to remember.
I am using Cygwin in Win7. I can run file on windows through ccygwin command line.
cygstart <your file>
when you run this command your file will open in windows.
Under the Windows command-line interpreter (cmd.exe) there is support for the start command. I know of somebody who implemented start in cygwin. You can find the page about it here.
You could also simply call cmd.exe (usually located in /cygdrive/c/windows/system32/cmd.exe) with the following arguments cmd /c "start yourfile.file"
If, like me, you are using putty to ssh locally on your windows machine to Cygwin as cmd.exe is a terrible console, you may want to change your sshd service to allow it to access the local desktop (this will only work on certain windows flavors) under the sshd windows service Logon properties.
Yes, there is an equivalent to Windows, try with xdg-open <your file>

Resources