Have some local files:
all_files/file_2.txt
file_1.txt
Locally create a repo, git init.
Create remote: ssh://scottco@174.1.1.1/~/public_html/git_test.git
Stage via "git add ." all those, commit. Ok, that works.
ssh onto remote server:
scottco@scottlawrencemassey.com [~]# cd public_html
This will be my bare repository, no website code, just git info goes here. I create the folder, cd into it, then git init --bare
scottco@scottlawrencemassey.com [~/public_html]# mkdir git_test.git
scottco@scottlawrencemassey.com [~/public_html]# cd git_test.git/
scottco@scottlawrencemassey.com [~/public_html/git_test.git]# git init --bare
Initialized empty Git repository in /home/scottlaw/public_html/git_test.git/
Seems to have worked...
scottco@scottlawrencemassey.com [~/public_html/git_test.git]# ls
./ ../ HEAD branches/ config description hooks/ info/ objects/ refs/
So now on my local, I push to the bare repo on the remote. It worked!
Ok, let's get out of there and create the repo where the site will be.
scottco@scottlawrencemassey.com [~/public_html/git_test.git]# cd ../
scottco@scottlawrencemassey.com [~/public_html]# ls
./
cgi-bin/
robots.txt
../
.htaccess
git_test.git/
scottco@scottlawrencemassey.com [~/public_html]# mkdir site_test
scottco@scottlawrencemassey.com [~/public_html]# cd site_test
scottco@scottlawrencemassey.com [~/public_html/site_test]# git init
Initialized empty Git repository in /home/scottlaw/public_html/site_test/.git/
Let's add a remote to the non-working tree
scottco@scottlawrencemassey.com [~/public_html/site_test]# cd ../
scottco@scottlawrencemassey.com [~/public_html/site_test]# git remote add git_test ../git_test.git/
What about adding a new file on my local: test_3.txt
Stage, Commit, Push. No error messages, think I am gtg, gtl, dtf.
The site needs that file too.
scottco@scottlawrencemassey.com [~/public_html/site_test]# git pull git_test master
From ../git_test
* branch master -> FETCH_HEAD
Updating c1c2b17..f968927
Fast-forward
0 files changed
create mode 100644 file_3.txt
scottco@scottlawrencemassey.com [~/public_html/site_test]# cd all_files/
scottco@scottlawrencemassey.com [~/public_html/site_test/all_files]# ls
./ ../ file_2.txt file_3.txt
Success!!
Pushing my luck:
Deleting file_3 from local, stage push
scottco@scottlawrencemassey.com [~/public_html/site_test/all_files]# git pull git_test master
remote: Counting objects: 5, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
From ../git_test
* branch master -> FETCH_HEAD
Removing all_files/file_3.txt
UW PICO 5.05 File: .git/MERGE_MSG
Merge branch 'master' of ../git_test
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
It merges, and asks for a commit message, but seemed to work:
scottco@scottlawrencemassey.com [~/public_html/site_test/all_files]# ls
./ ../ file_2.txt