Debugging ‘git fetch’ on Windows 7

Assuming you’re using PowerShell:

1. Set GIT_TRACE=1

$env:GIT_TRACE = 1

NOTE: for more debug info use: GIT_CURL_VERBOSE=1

2. Check this is set by viewing the environment variable (use %% for cmd – see later):

> $Env:GIT_TRACE
1

3. Run your ‘git fetch’ with whatever remote you’ve defined. See notes on defining a remote repo.

git fetch <your-remote-nickname>

4. You should now see TRACE output like this:

trace: run_command: ‘ssh’…

—-

Notes:

1. If you haven’t defined a remote here’s how:

git init

git remote add <your remote nickname> <git@host:/path/to/repo.git>

Then check by listing your remote repos with:

git remote -v

2. If you’re using the Windows default shell then view an environment variable as follows:

echo %GIT_TRACE%

Using Capistrano to deploy your Rails app

1. if you haven’t got Rails installed locally then do it now. 

As of this blog post Rails 4, which you should be using, is pre-release so: 

gem install rails –pre

but drop the –pre when Rails 4 is no longer pre-release.

–pre means install the prerelease rails gem.

http://stackoverflow.com/questions/4041902/what-does-pre-do-in-gem-install-rails-pre

2. create a simple Rails app

rails new myapp

3. upload your Rails app to github

– create a git rep locally if it doesn’t exist

git init; git add .; git commit -am “first commit”

– create a github repo at 

https://github.com/new 

This should tell you what you need to do next however in short:

git remote add origin git@github.com:you/your_repo.git

git push -u origin master

4. capify with

capify .

(and remember to push to git with:

git add .; git commit -am “with capistrano”

git push -u origin master)

Note: as you’re running Rails you should put your Capistrano config information in config/deploy.rb. So, your Capfile should look like this:

load ‘config/deploy’

and your config/deploy.rb file should have all the Capfile details like 

set :git_username, “your_git_username”

set :repository,  “git@github.com:you/your_repo.git”

etc…

5. Use SSH agent forwarding initially

https://help.github.com/articles/managing-deploy-keys

Specifically, make sure you’ve got it set right locally:

https://help.github.com/articles/using-ssh-agent-forwarding

6. Read also this post if you’re having problems with your ssh key:

e.g. 

default_run_options[:pty] = true

helps debug. And add your host to your known_hosts file by doing ssh git@github.com and entering yes (it doesn’t matter that the login won’t succeed).

http://stackoverflow.com/questions/7863070/capistrano-deploy-host-key-verification-failed

7. Then use:

cap deploy:setup 

and

cap deploy:cold

For more details of what deploy:cold does see:

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy.rb#L200-L203

Notes

Some issues:

I found Capistrano wasn’t creating directories in the releases directory with this option:

set :deploy_via, :remote_cache

http://stackoverflow.com/questions/8246007/capistrano-will-not-create-releases

Also:

To automatically run ‘bundle install’ on the server, add this to your deploy.rb file:

require ‘bundler/capistrano’

http://gembundler.com/v1.3/deploying.html

8. If using a Dreamhost VPS you may need to unset the DreamHost Managed Apache setting in VPS > Configure Server.

http://wiki.dreamhost.com/VPS#httpd.conf

More on deploying Rails including details on Passenger (aka mod_rails), JRuby, Capistrano and Hosting:

http://rubyonrails.org/deploy

Using Capistrano to deploy your Rails app

1. if you haven’t got Rails installed locally then do it now. 

As of this blog post Rails 4, which you should be using, is pre-release so: 

gem install rails –pre

but drop the –pre when Rails 4 is no longer pre-release.

–pre means install the prerelease rails gem.

http://stackoverflow.com/questions/4041902/what-does-pre-do-in-gem-install-rails-pre

2. create a simple Rails app

rails new myapp

3. upload your Rails app to github

– create a git rep locally if it doesn’t exist

git init; git add .; git commit -am “first commit”

– create a github repo at 

https://github.com/new 

This should tell you what you need to do next however in short:

git remote add origin git@github.com:you/your_repo.git

git push -u origin master

4. capify with

capify .

(and remember to push to git with:

git add .; git commit -am “with capistrano”

git push -u origin master)

Note: as you’re running Rails you should put your Capistrano config information in config/deploy.rb. So, your Capfile should look like this:

load ‘config/deploy’

and your config/deploy.rb file should have all the Capfile details like 

set :git_username, “your_git_username”

set :repository,  “git@github.com:you/your_repo.git”

etc…

5. Use SSH agent forwarding initially

https://help.github.com/articles/managing-deploy-keys

Specifically, make sure you’ve got it set right locally:

https://help.github.com/articles/using-ssh-agent-forwarding

6. Read also this post if you’re having problems with your ssh key:

e.g. 

default_run_options[:pty] = true

helps debug. And add your host to your known_hosts file by doing ssh git@github.com and entering yes (it doesn’t matter that the login won’t succeed).

http://stackoverflow.com/questions/7863070/capistrano-deploy-host-key-verification-failed

and

https://help.github.com/articles/deploying-with-capistrano

7. Then use:

cap deploy:setup 

and

cap deploy:cold

For more details of what deploy:cold does see:

https://github.com/capistrano/capistrano/blob/master/lib/capistrano/recipes/deploy.rb#L200-L203

Notes

Some issues:

I found Capistrano wasn’t creating directories in the releases directory with this option:

set :deploy_via, :remote_cache

http://stackoverflow.com/questions/8246007/capistrano-will-not-create-releases

Also:

To automatically run ‘bundle install’ on the server, add this to your deploy.rb file:

require ‘bundler/capistrano’

http://gembundler.com/v1.3/deploying.html

8. If using a Dreamhost VPS you may need to unset the DreamHost Managed Apache setting in VPS > Configure Server.

http://wiki.dreamhost.com/VPS#httpd.conf

More on deploying Rails including details on Passenger (aka mod_rails), JRuby, Capistrano and Hosting:

http://rubyonrails.org/deploy

Capistrano

Is awesome.

1. check you've got an up-to-date version of Ruby Gems (i.e. >=1.3.x), e.g.

gem -v

2. install

gem install capistrano

3. create your Capfile

desc “List files on server”

task :ls, :hosts => “myhost.com” do

run “ls”

end

4. and run with:

cap ls

(if you need to set a username, use:

set :user, “your user”

task :ls … etc…

OR just add it into the hostname, e.g.

myuser@myhost.com

)

5. list tasks with

cap -T

(assuming you've got a description for each task)

Capistrano requirements – you must:

– use SSH to connect to your remote machines and

– be reasonably familiar with Ruby

https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started

GitHub:

https://github.com/capistrano/capistrano

And if you're implementing Capistrano for PHP:

http://www.davegardner.me.uk/blog/2012/02/13/php-deployment-with-capistrano/

 

Capistrano

Is awesome. 

1. check you’ve got an up-to-date version of Ruby Gems (i.e. >=1.3.x), e.g.

gem -v

2. install

gem install capistrano

3. create your Capfile

desc “List files on server”

task :ls, :hosts => “myhost.com” do

  run “ls”

end

4. and run with:

cap ls

(if you need to set a username, use:

set :user, “your user”

task :ls … etc…

OR just add it into the hostname, e.g.

myuser@myhost.com

)

5. list tasks with 

cap -T

(assuming you’ve got a description for each task)

Capistrano requirements – you must: 

– use SSH to connect to your remote machines and 

– be reasonably familiar with Ruby

https://github.com/capistrano/capistrano/wiki/2.x-Getting-Started

 

GitHub: 

https://github.com/capistrano/capistrano

and website:

http://capistranorb.com

Coda 1.7.5 beach ball of death

I recently had to use a backup Mac and found my favourite SSH tool, Coda (which comes with built-in SSH connections), was crashing when connecting to remote sites.

The solution was amazingly simple. From the Coda menu:

Sites > Show Sites

then just toggle Sites > Arrange by. I had it on None so:

Sites > Arrange By > Name

then

Sites > Arrange By > None

 

And bizarrely, that was the end of the my BBOD (otherwise known as a beach ball of death or spinning beachball of death).