一、建立GitHub远程仓库
在Github官网上建立一个仓库
二、安装Git
在终端运行
yum install git
之后可以查看其版本:
git --version
三、克隆远程仓库到本地
新建仓库之后点开可以看见http网址,直接复制即可
git clone https://github.com/KUI-SI-MING/Linux.git/
克隆成功后可以看到
四、添加到索引库
将需要上传的文件拷贝到仓库目录下后
git add path //path可以是文件也可以是目录
五、将索引库提交到本地版本库
git commit -m "描述信息"
提交成功后可以看到
[kui@localhost Kui]$ git commit -m "First"
[master(根提交) 4c9ee01] First
Committer: kui_nian <kui@localhost.localdomain>
您的姓名和邮件地址基于登录名和主机名进行了自动设置。请检查它们正确
与否。您可以通过下面的命令对其进行明确地设置以免再出现本提示信息:
git config --global user.name "Your Name"
git config --global user.email you@example.com
设置完毕后,您可以用下面的命令来修正本次提交所使用的用户身份:
git commit --amend --reset-author
3 files changed, 59 insertions(+)
create mode 100755 myshell/Makefile
create mode 100755 myshell/myshell
create mode 100755 myshell/myshell.c
[kui@localhost Kui]$ git config --global user.name "Your Name"
[kui@localhost Kui]$ git config --global user.name "Your Name"
[kui@localhost Kui]$ git config --global user.name "kui-si-ming"
[kui@localhost Kui]$ git config --global user.email kuisi5495@163.com
[kui@localhost Kui]$ git commit --amend --reset-author
Error detected while processing /home/kui/.vimrc:
line 5:
E492: Not an editor command: Plug 'Valloric/YouCompleteMe'
line 6:
E492: Not an editor command: Plug 'bling/vim-airline'
line 7:
E492: Not an editor command: Plug 'vim-airline/vim-airline-themes'
line 8:
E492: Not an editor command: Plug 'morhetz/gruvbox'
line 9:
E492: Not an editor command: Plug 'octol/vim-cpp-enhanced-highlight'
line 10:
E492: Not an editor command: Plug 'SirVer/ultisnips'
line 11:
E492: Not an editor command: Plug 'tpope/vim-surround'
line 12:
E492: Not an editor command: Plug 'flazz/vim-colorschemes'
line 13:
E492: Not an editor command: Plug 'scrooloose/nerdtree'
line 14:
E492: Not an editor command: Plug 'python-mode/python-mode'
line 15:
E492: Not an editor command: Plug 'scrooloose/nerdcommenter'
line 16:
E492: Not an editor command: Plug 'Yggdroot/LeaderF'
line 17:
E492: Not an editor command: Plug 'cpiger/NeoDebug'
line 18:
E492: Not an editor command: Plug 'ryanoasis/vim-devicons'
line 22:
E492: Not an editor command: Plug 'autozimu/LanguageClient-neovim', { 'branch': 'next', 'do': 'bash install.sh', }
line 29:
E185: Cannot find color scheme 'luna-term'
line 58:
E518: Unknown option: foldmethod=marker
line 141:
E518: Unknown option: foldenable
line 149:
E518: Unknown option: foldmethod=indent
line 150:
E518: Unknown option: foldlevel=99
line 294:
E31: No such mapping
line 295:
E31: No such mapping
line 296:
E31: No such mapping
line 297:
E31: No such mapping
line 298:
E31: No such mapping
line 299:
E31: No such mapping
line 300:
E31: No such mapping
line 301:
E31: No such mapping
Press ENTER or type command to continue
[master 0ec225e] First
3 files changed, 59 insertions(+)
create mode 100755 myshell/Makefile
create mode 100755 myshell/myshell
create mode 100755 myshell/myshell.c
按照提示信息修改用户名和邮箱
六、部署到远程仓库
git push origin master
部署成功之后可以看到
[kui@localhost Kui]$ git push origin master
Username for 'https://github.com': kui-si-ming
Password for 'https://kui-si-ming@github.com':
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 3.74 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote:
remote: Create a pull request for 'master' on GitHub by visiting:
remote: https://github.com/KUI-SI-MING/Kui/pull/new/master
remote:
To https://github.com/KUI-SI-MING/Kui.git
* [new branch] master -> master
这样就大功告成啦。在官网就可以看到