cmdref.net - Cheat Sheet and Example

cmdref.net is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools


Sidebar








Etc


Reference














.

middleware:version-control:git:dotfiles.html



Git - How to use Git.

How to manage dotfiles with GitHub

Create dotfiles

host1 ]$ mkdir dotfiles
host1 ]$ cd dotfiles
host1 ]$ vi .vimrc
host1 ]$ vi .bashrc
host1 ]$ vi dotfilelink.sh
#!/bin/sh


FILE=".vimrc .bashrc"
cd ~/
for i in $FILE
do
    test -f ~/${i} && cp ~/${i}  ~/${i}.`date -d '1day ago' +%Y%m%d`
    ln -s ~/dotfiles/${i} ~/${i}
done


Git User Configuration

host1 ]$ git config --global user.name "Takaaki Kurihara"
host1 ]$ git config --global user.email 32270422+kuritaka@users.noreply.github.com

host1 ]$ git config --global --list    <- check user configuration


push GitHub

host1 ]$ cd ~/dotfiles
host1 ]$ git init
host1 ]$ git add .
host1 ]$ git commit -m 'first commit'
host1 ]$ git remote add origin git://github.com/your_name/dotfiles.git
host1 ]$ git -u push origin master 


Update Files

host1 ]$ vi xxxxx
host1 ]$ git add -A
host1 ]$ git status
host1 ]$ git commit -m "anything"
host1 ]$ git push origin master


clone with Other Server

host2 ]$ cd ~/
host2 ]$ git clone https://github.com/your_name/dotfiles
host2 ]$ ls
dotfiles
host2 ]$ sh dotfiles/dotfileslink.sh


Resync with GitHub




middleware/version-control/git/dotfiles.html.txt ยท Last modified: 2020/04/25 by admin

Page Tools