How to open file from git repository in sublime text (Mac)? - html

How can I open an html file from a cloned git repository on Sublime Text on Mac? I've tried the subl command but it didn't work.

You can open the whole project from a terminal. Just follow the instructions here https://www.sublimetext.com/docs/3/osx_command_line.html
You have to run this command before
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
Clone you repo and after that do:
cd <project_dir> && subl ./

Related

How to open Sublime text using Git Bash Command prompt

$ touch hello.html
$ subl .
bash: subl: command not found
I created HTML file using git bash command prompt and I want to open it on Sublime Text 3 using git bash command prompt. But above code is not working.
First I had to create new Environment Variable Path. now the code is working.
$ cd test1/
$ touch hello.html
$ subl hello.html
or $ subl
Following youtube video might be helpful.
How to Open Sublime Text 3 from Command Prompt in Windows

Sublime Text subl shortcut not working: ln: /Users/edmundmai/bin/subl: No such file or directory

Hi I am trying to set up the terminal shortcut for sublime text 2(subl) but it's not working. I'm following the directions on https://github.com/mhartl/rails_tutorial_sublime_text/blob/master/README.md but can't get past the first step.
When I type:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl
I receive the error
ln: /Users/edmundmai/bin/subl: No such file or directory
What should I do?
This probably means that there is no ~/bin directory. Which also probably means that it isn't in the PATH. So just continue on to the next suggestion:
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/bin/subl
Alternatively you can put it to your local bin:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
it may need creating the bin beforehand:
mkdir /usr/local/bin
Another approach is define subl as your shell alias
http://opensourcehacker.com/2012/05/11/sublime-text-2-tips-for-python-and-web-developers/#Open_files_from_command-line
This is the recommended approach as it is against the best practices to add symlinks in /usr/bin

git checkout removedFile in Mercurial?

What is the Mercurial equivalent of the command git checkout removedFile? The word removedFile means the removal by the basic-shell rm -command, not by git rm -command.
hg revert removedFile
should put your missing file back.
What does git checkout removedFile do for you? For me it give a nice, sensible error:
ry4an#four:~$ git init test
Initialized empty Git repository in /home/ry4an/test/.git/
ry4an#four:~$ cd test/
ry4an#four:~/test$ echo this > file
ry4an#four:~/test$ git add file
ry4an#four:~/test$ git commit
[master (root-commit) 1b017c5] file added
1 file changed, 1 insertion(+)
create mode 100644 file
ry4an#four:~/test$ git rm file
rm 'file'
ry4an#four:~/test$ git commit
[master ec695d4] dsdfsdf
1 file changed, 1 deletion(-)
delete mode 100644 file
ry4an#four:~/test$ git checkout file
error: pathspec 'file' did not match any file(s) known to git.
If you're asking how you can view the contents of a removed files hg cat is a fine command to do it, and you can find a revision id using hg log removedFile.

Sublime Text 2: can't create symlink to subl, says "bin/subl: No such file or directory"

I've downloaded and installed Sublime text 2. I am following the directions here: but I am stuck at this part:
The first task is to make a symlink to subl. Assuming you've placed Sublime Text 2 in the Applications folder, and that you have a ~/bin directory in your path, you can run:
ln -s "/Applications/Sublime Text " ~/bin/subl
However, when I do this it tells me /Users/User/bin/subl: No such file or directory.
What should I do?
Thanks!
I'd recommend adding it to your local bin:
ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Edit: Make sure your local bin directory exists before running this command:
mkdir /usr/local/bin
I add my sym links to /usr/local/bin, for Sublime Text 3 I set mine up like so:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Then you can open up the current directory list using:
subl .
If you find subl abbreviation annoying as some people I know seem to do, then change it to 'sublime'
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
And call it using:
sublime .
Alternatively, you can run this:
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
Note: The above snippet puts the symlink in /bin/subl rather than ~/bin/subl.
and that you have a ~/bin directory in your path
First, you need that directory for the ln command to work, and eventually, it will need to be in your path to do whatever it is you are trying to do.
To make the directory:
mkdir ~/bin
Adding it to your execution path is trickier, but there are plenty of resources available.
Following Simon's example above, For Sublime Text 3, here is what worked for me:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Please note, to install (on Mac OS Sierra 10.12.6) in /usr/local/bin sudo was required.
Info
OS: Mac OSX High Sierra 10.13.6 (17G65)
Sublime Version: Version 3.1.1 Build 3176
I took the command from SublimeText website
Got An Error
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" ~/bin/subl
ln: /Users/jkirchoff/bin/subl: No such file or directory
Did Some Checking
Just to make sure the path exists.
NOTE: the "'s allow the space in the path.
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl"
ln: ./subl: File exists
Compared Note from this page
What #NotSimon wrote on this page, Then Ran:
ln -s "/usr/local/bin/subl"
ln: ./subl: File exists
and then followed the rest.
The Complete Line that worked for me:
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
Success
Now I can run subl as a command in Terminal!
This command opens the directory as a "Project" in SublimeText.
subl ~/Desktop
Optional
I followed the SublimeText recommendation & added this to my
~/.bash_profile.
The command works without it, just following guidelines.
echo "export EDITOR='subl -w'" >> ~/.bash_profile
Just remove tilde ~ from ~/bin/subl
If you're using mac terminal,
just replace "Sublime Text 2.app"
with "Sublime\ Text\ 2.app/" anywhere within the command.
That should do it.

"No such repository hgadmin" while installing mercurial-server.

I'm trying to install mercurial-server. After adding my keys to keys/root and refreshing auth, I tried to clone hgadmin-repo but I get the following error:
$ hg clone ssh://hg#<domain>/hgadmin
remote: mercurial-server: no such repository hgadmin
abort: no suitable response from remote hg!
Anyone know what's the problem?
I had this same problem and for me it was a problem with the installation of the hgadmin repository. When I installed the package, I got errors from python saying the mercurial package wasn't installed. I assume that happened when mercurial-server tried to initialize the hgadmin repository. So when I went to checkout the hgadmin respistory, there was no .hg directory:
root#myshost:/var/lib/mercurial-server/repos# cd hgadmin/
root#myshost:/var/lib/mercurial-server/repos/hgadmin# ls -a
. ..
In order to resolve this, I did:
easy_install mercurial
sudo apt-get purge mercurial-server
sudo rm -rf /var/lib/mercurial-server
sudo apt-get install mercurial-server
And then continued on with the directions here:
http://kurtgrandis.com/blog/2010/03/20/gitosis-for-mercurial/
Thanks a lot Randy for exposing the exact issue here.
I struggled with the same problem, and found an alternative approach to solving it (without the need to purge and re-install).
You can initialize the hgadmin repo manually and install the hooks, achieving the same effect as a normal installation. You need to to it as 'hg' user though.
Procedure
The commands worked for my environment (Ubuntu 10.04.4 / Hg 1.4.3)
First initialise a mercurial repository in /var/lib/mercurial-server/repos/hgadmin :
$ sudo su hg
$ cd ~/repos/hgadmin/
$ hg init
Then the only difference I found with a normally initialized hgadmin repo (that I deployed in a VM for comparison) were the hooks in .hg/hgrc file. So open the file :
$ vim .hg/hgrc
and paste this exact content :
# WARNING: when these hooks run they will entirely destroy and rewrite
# ~/.ssh/authorized_keys
[extensions]
hgext.purge =
[hooks]
changegroup.aaaab_update = hg update -C default > /dev/null
changegroup.aaaac_purge = hg purge --all > /dev/null
changegroup.refreshauth = python:mercurialserver.refreshauth.hook
Are you sure your clone command syntax is correct? I see at least two errors in it:
You must put the repo you're cloning (not just the destination)
Just as for push, you must use two slashes before hgadmin:
Example FAILING (missing the source repo and using only one '/' before 'home')
$ hg clone ssh://John#127.0.0.1/home/John/delme
Example FAILING (missing the source repo)
$ hg clone . ssh://John#127.0.0.1/home/John/delme
Example SUCCEEDING:
$ hg clone . ssh://John#127.0.0.1//home/John/delme