I'm looking for some assistance, please, using Emacs / Magit to push the local repository changes to the remote website and to Github in one fell-swoop.
I found a non-Emacs / non-Magit related thread ( https://stackoverflow.com/a/3195446/2112489) , with comments stating that it is the definitive answer on pushing to a remote and to Github, and it has a few hundred thumbs-up. I assume (perhaps incorrectly) that is a good starting point for the local .gitconfig
file in the $HOME
directory on my computer.
[remote "GitHub"]
url = git@github.com:elliottcable/Paws.o.git
fetch = +refs/heads/*:refs/remotes/GitHub/*
[branch "Master"]
remote = GitHub
merge = refs/heads/Master
[remote "Codaset"]
url = git@codaset.com:elliottcable/paws-o.git
fetch = +refs/heads/*:refs/remotes/Codaset/*
[remote "Paws"]
url = git@github.com:Paws/Paws.o.git
fetch = +refs/heads/*:refs/remotes/Paws/*
The basic Push command in Emacs / Magit only pushes one at a time:
C-u P P [and then use arrow keys to select from the choices in the minibuffer] RET
See the Magit cheatsheet of available commands: http://daemianmack.com/magit-cheatsheet.html
Tentative thinking -- use /usr/local/git/bin/git remote -v
to obtain a listing of remotes that have already been configured, and then use the results to push to each one . . . doable, but complex.
$ MP:my_project.git HOME$ /usr/local/git/bin/git remote -v
origin git@github.com:lawlist/my_project.git (fetch)
origin git@github.com:lawlist/my_project.git (push)
remote_website lawlist@my-website.com:my_project.git (fetch)
remote_website lawlist@my-website.com:my_project.git (push)
COMMAND-LINE RECIPE -- pushing separately to the remote and to Github:
;; Setup the remote repository and the hook; and the remote destination folder.
ssh lawlist@my-website.com
mkdir /home/lawlist/my_project.git
cd my_project.git
git init --bare
;; git update-server-info # If planning to serve via HTTP
cat > /home/lawlist/my_project.git/hooks/post-receive ;; RET
#!/bin/sh ;; RET
GIT_WORK_TREE=/home/lawlist/my_project git checkout -f ;; RET
;; C-d
chmod 755 /home/lawlist/my_project.git/hooks/post-receive
mkdir /home/lawlist/my_project
exit
;; On local machine.
mkdir /Users/HOME/.0.data/.0.emacs/elpa/my_project.git
touch /Users/HOME/.0.data/.0.emacs/elpa/my_project.git/README.md
cd /Users/HOME/.0.data/.0.emacs/elpa/my_project.git
/usr/local/git/bin/git init
/usr/local/git/bin/git add .
/usr/local/git/bin/git commit -m "First commit."
curl -u lawlist:12345678 https://api.github.com/user/repos -d '{"name":"my_project.git"}'
/usr/local/git/bin/git remote add origin git@github.com:lawlist/my_project.git
/usr/local/git/bin/git remote add remote_website lawlist@my-website.com:my_project.git
/usr/local/git/bin/git push origin master
/usr/local/git/bin/git push remote_website master
;; For modification of local files
/usr/local/git/bin/git add .
/usr/local/git/bin/git commit -m "This is a modification . . . ."
/usr/local/git/bin/git push origin master
/usr/local/git/bin/git push remote_website master
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…