How do I open Sublime text from Git Bash in Windows? I tried adding the alias at the ~/.bashrc file but nothing worked. I was looking for something very easy but I could not find in the internet.
相关问题
- How to Debug/Register a Permanent WMI Event Which
- the application was unable to start correctly 0xc0
- Why does recursive submodule update from github fa
- Extended message for commit via Visual Studio Code
- Windows 7: How can I get a list of all Windows use
相关文章
- 请教Git如何克隆本地库?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
- SSIS solution on GIT?
- Is there a version control system abstraction for
- ssh: Could not resolve hostname git: Name or servi
- Cannot commit changes with gitextensions
- git: retry if http request failed
Create
.bash_profile
file underC:\Users\YourUserName\
and add the following line in the file:I'm pretty new to this stuff and to git and sublime text. I'm taking the Udacity course on git right now, and was unable to get git bash to open sublime text.
I kept getting bash: subl: C:/Program command not found
or something like that
I found my problem ended up being I had my slashes going the incorrect way, and I found if you have spaces in your file path, you have to add a slash everytime you have a space and it will fix the problem.
I ended up typing
echo 'alias subl="C:/Program\ Files/Sublime\ Text\ 3/subl.exe"' >> ~/.bashrc
then subl
and sublime text was opened.
My original file path was-
C:\Program Files\Sublime Text 3
so make sure you have your slashes going the correct way, and if you have spaces in your file path, to add the necessary slash after a word.
I'm on windows 10 using sublime text 3 and git bash
Hopefully this saves someone else a lot of time.
Create a text file called subl (with no extension) with the following content:
Copy it into the C:\Program Files (x86)\Git\bin folder. 32bit Copy it into the C:\Program Files\Git\usr\bin folder. 64bit
Now to open the file enter the following command on Windows Git Bash
or
One of the problems I had was that I had to use backslashes
\
in the path of the directory instead of normal slashes/
, like the everyone here is using. Then I had to escape backslashes using double backslash\\
. So, in my case I wrote the path like this:I was having some difficulty getting this to work for me as well despite all the answers listed here. I found that modifying my .bashrc file through VIM as suggested here fixed the problem for me. I'm using Git bash on windows 10.
First I opened bash to my home directory, you can use cd~ to make sure you're in the right place.
Then, I created my .bashrc file using:
touch .bashrc
Then I went to edit that file using:
press the
i
key to enter insert modeenter:
As noted by pretty much everyone else this will have to be the correct path to your sublime_text.exe location. A quick search of your C:\ drive for sublime_text.exe should yield this location.
now hit
esc
to exit input modeEnter
:
w
q
enter
to save and exit vimexit bash and reopen to apply the new settings
Entering
subl
should open sublime text editor now.I had tried editing my .bashrc file with wordpad and sublime text itself, but for some reason editing in vim and making sure all the forward slashes and backslashes were correct as noted above worked for me.
I had found a rogue ^M character after my file path using some of the other methods which I think might have been complicating things as well. deleting this character in vim also fixed the problem after using SawyerDoesStuff's solution.
Thanks for letting me revive an older post and I hope this helps.
Locate the folder where Sublime Text is installed. Here I'am taking an example of Sublime Text 3 which is installed in C:/Program Files. For many users it is present in C:/Program Files (x86).
Run the following command (based upon your requirement):
Or
Try Closing and Re-Opening Git-Bash. If it works, then you're done.
Otherwise, read this documentation from Udacity.