Johnathan Kong
Mark files as ignored
To mark files as ignore when doing a git add, create a .gitignore file in the directory and add the files that you want to be ignored.
1 | echo "<files>" > .gitignore |
Install a LAMP development on Ubuntu
1 | sudo apt-get install lamp-server^ |
Change host name of server
how to change the host name of an ubuntu server
1 2 3 | echo "<name>" > /etc/hostname hostname -F /etc/hostname vi /etc/hosts (add hostname to 127.0.0.1) |
If you are running on a linode server, you will have to edit your /etc/default/dhcpcd and comment out the SET_HOSTNAME=’yes’
Adding a User
Add a user using the gitosis
1 2 3 4 | get user to create a public key (ssh-keygen -t rsa (cmd works in the git bash for windows)) copy key do gitosis-admin/keydir rename key to username add user to gitosis under the proper groups |
Creating a repo
How to create a repo from any server. Before this step, you will have to edit your gitosis file to ensure that this repo exists in the “writable” and the user has permissions (put is name in the “members”).
1 2 3 4 5 6 7 8 | Create a repo directory if you don't have one already Change to the directory git init git remote add origin git@<your server>:<your repo>.git add/edit the files git add * git commit -m "<message>" git push origin master |
Editing gitosis.conf
This file is really easy to do, but I just wanted to have a reference as to the layout of the file
1 2 3 | [group <group name>] members = <members that have access. These are the names of your public key files (.pub)> writable = <repos that are part of the group that the members have access to> |
Git and Gitosis Quick Setup guide
Had a hell of a time getting this to work. Here are my exact deployment steps to get git up and running.
1 2 3 4 5 6 7 8 9 10 | apt-get install git-core
apt-get install gitosis
sudo adduser git
sudo mkdir /home/git/.ssh
sudo chown -R git:git /home/git/.ssh
sudo chmod 700 !$
ssh-keygen -t rsa
cp ~/.ssh/id_rsa.pub /tmp/my_key.pub
sudo -H -u git gitosis-init < /tmp/my_key.pub
git clone git@localhost:gitosis-admin.git |
Remove a staged file during a creation of a new repo
1 | git rm --cached [filename] |
Reset identity
1 | ALTER TABLE tablename AUTO_INCREMENT = 1 |
Import CSV into table
The easiest way that I’ve found to import a csv file into a table is to create a table that has the exact columns as the file, then run the following command:
1 2 3 4 | LOAD DATA LOCAL INFILE '<full path with file name>' INTO TABLE import FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' |