Here are some steps I used to create a remote Git repo based on my local files.
Create the folder for the new application and change to that directory.
> mkdir /var/www/html/newapp
> cd /var/www/html/newapp
Make sure git is installed, if not install it
> sudo apt-get install git-core git-doc
Initialize the folder to become a git directory
> git init
********* Now switch to your local files ***********
> cd ~/myapp
Initialize git with the local folder as well
>git init
Tell git about yourself
>git config user.name "Your Name"
>git config user.email "Your Email"
Now, tell git which server to talk too
>git remote add origin username@yourdomain.com:/var/www/html/newapp/.git
Make sure that this user has SSH access to the box.
>git config branch.master.remote origin
>git config branch.master.merge refs/heads/master
Make your initial commit and push it to the remote server.
>git commit -a -m "Initial commit"
>git push origin master
And viola! Your files will be pushed to the remote server. Now, I was wondering why when I went to access the server, the files didn't seem to be in the working directory, even though I could see the log showed my Initial commit. It turns out that when things are pushed to master, they enter a limbo state. You have to do a git checkout -f, to actual have the commit become live. Note that doing a git checkout -f, will throw away any changes that have been made on the remote server.
To make the updating of the server easier, you can do the following:
> vi /var/www/html/newapp/.git/hooks/post-receive
Add - git checkout -f
Save the file
>chmod +x /var/www/html/newapp/.git/hooks/post-receive
Showing posts with label git. Show all posts
Showing posts with label git. Show all posts
Friday, July 17, 2009
Saturday, April 18, 2009
Git tips
tig - cool way to look at commits
git send-email 0001-patch1 0002-patch2 etc etc
To get patches from email you can use mutt, fetchmail, etc. You can even use Thunderbird to get patches, by saving it as a .eml file.
git am -u -s -3 -i /path/to/patch.eml
-u = use utf-8
-s = sign the commit
-3 = use three-way merge, Galen says that this just makes it work
-i = use interactive method
git send-email 0001-patch1 0002-patch2 etc etc
To get patches from email you can use mutt, fetchmail, etc. You can even use Thunderbird to get patches, by saving it as a .eml file.
git am -u -s -3 -i /path/to/patch.eml
-u = use utf-8
-s = sign the commit
-3 = use three-way merge, Galen says that this just makes it work
-i = use interactive method
Subscribe to:
Posts (Atom)