--- /dev/null
+CD := cd
+ECHO := echo
+GIT := git
+LS := ls
+MKDIR := mkdir
+SSH := ssh
+
+SERVER := www.j8takagi.net
+REPOSDIR := /home/git
+
+PROJECTNAME := $(notdir $(CURDIR))
+REPOSNAME := $(PROJECTNAME).git
+REPOS := $(REPOSDIR)/$(REPOSNAME)
+SERVERREPOS := $(SERVER):$(REPOS)
+
+REPOSEXT := $(strip $(shell $(SSH) $(SERVER) $(LS) -d $(REPOS) || $(ECHO)))
+GITORIGIN := $(strip $(shell $(GIT) remote | grep origin))
+
+.PHONY: gitorigin-add gitorigin-show gitpush gitorigin-clean gitrepos
+
+gitpush: gitorigin
+ $(GIT) push --set-upstream origin master
+
+gitorigin: gitrepos
+ $(if $(GITORIGIN),@($(ECHO) 'remote origin exists. git remote set-url origin <url>'),$(GIT) remote add origin $(SERVERREPOS))
+
+gitrepos:
+ $(if $(REPOSEXT),,$(SSH) $(SERVER) '$(MKDIR) $(REPOSDIR)/$(REPOSNAME) && $(CD) $(REPOS) && $(GIT) init --bare')
+
+gitorigin-clean:
+ $(GIT) remote remove origin