Skip to content

Instantly share code, notes, and snippets.

@alwerner
alwerner / SFTP with public key
Created August 13, 2012 15:28
SFTP with public key
host ftp.example.com
IdentityFile ~/.ssh/key-for-example.pem
HostName example.com
User foo
# Source: http://fetchsoftworks.com/fetch/messageboard/sftp-with-public-key-how
If you are in the directory you want the contents of the git repository dumped to, run:
git clone git@github.com:whatever .
The "." at the end specifies the current folder as the checkout folder.
@alwerner
alwerner / ssh path to github repo
Last active October 9, 2015 08:08
ssh path to github repo
Make sure you're using the SSH one:
ssh://git@github.com/username/repo.git.
And NOT the https or git one.
Fix the url in the .git/config file.
@alwerner
alwerner / Git Remove Deleted Files
Last active October 10, 2015 10:27
Remove Deleted Files
# to remove already deleted files:
git add -u .
git commit -m "manually deleting files"
@alwerner
alwerner / php conditional loading based on host
Last active October 12, 2015 20:29
php conditional loading based on host
<?php
if ($_SERVER["HTTP_HOST"] == 'mydomain.com' || $_SERVER["HTTP_HOST"] == 'www.mydomain.com' ) {
// insert, for instance, analytics code here.
}
git rm -r --cached .
This removes everything from the index, then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"
@alwerner
alwerner / Adding a git alias to .gitconfig
Last active December 13, 2015 19:38
Adding a git alias to .gitconfig
git config --global alias.<NAME> "<COMMAND>"
@alwerner
alwerner / retroactively add items to .gitignore
Last active March 21, 2022 23:14
retroactively add items to .gitignore
// make change to .gitignore
git rm --cached <filename>
// or, for all files
git rm -r --cached .
git add .
// then