Related Pages
Git - How to use Git.
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
When you create a repository on GitHub, the following page will be displayed
host1 ]$ git config --global user.name "xxxxx" # GitHub's Login Name host1 ]$ git config --global user.email "xxxxx@users.noreply.github.com" # check with GitHub Page(This is important of GitHub's site icon) host1 ]$ git config --global --list <- check user configuration
$ git config --global credential.helper cache
$ git config --global credential.helper cache $ ~/.git-credentials
host1 ]$ vi ~/.ssh/id_rsa_github host1 ]$ vi ~/.ssh/config Host github github.com HostName github.com IdentityFile ~/.ssh/id_rsa_github User git
$ ssh -T git@github.com Warning: Permanently added 'github.com,xx.xx.xx.xx' (RSA) to the list of known hosts. Hi kuritaka! You've successfully authenticated, but GitHub does not provide shell access.
host1 ]$ cd ~/dotfiles host1 ]$ git init host1 ]$ git add . host1 ]$ git commit -m 'first commit' host1 ]$ git branch -M main #main is local repository host1 ]$ git remote add origin https://github.com/your_name/dotfiles.git host1 ]$ git remote -v <- check remote repogigory host1 ]$ git push -u origin main #origin is remote repository, main is local repository Username for 'https://github.com': xxxxxxx Password for 'https://xxxxxxx@github.com': << xxxxx Your TOKEN xxxxx>>
host1 ]$ git remote set-url origin git@github.com:[user]/[repogitory.git] host1 ]$ git remote -v <- check remote repogigory host1 ]$ git push -u origin main
host1 ]$ vi xxxxx host1 ]$ git add -A host1 ]$ git status host1 ]$ git commit -m "anything" host1 ]$ git push origin main #origin is remote repository, main is local repository
Or
host1 ]$ vi xxxxx host1 ]$ git status host1 ]$ git commit -a -m "anything" host1 ]$ git push
host2 ]$ cd ~/ host2 ]$ git clone https://github.com/your_name/dotfiles host2 ]$ ls dotfiles host2 ]$ sh dotfiles/dotfileslink.sh
host2 ]$ git status host2 ]$ git pull host2 ]$ sh dotfiles/dotfileslink.sh
Related Pages
Git - How to use Git.