
在 Linux 系统中,如何将普通源文件和普通头文件上传到 Gitee ?
Git 是一个分布式的版本控制器,目前可以理解成百度云盘,其次,在 Linux 系统中,Git 也是一个软件/工具/指令,在 Windows 系统中,Git 也是一个软件/工具,Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的分布式的版本控制器,而 Gitee 或 Github 则都是基于 Git 搭建起来的网站,在本地和远端都有着自己的 Git 仓库 、
登录 Gitee ,新建一个 Gitee 仓库,若不想在 Gitee 上面新建一个远端的 Gitee 仓库,则也可以在本地新建一个本地的 Gitee 仓库,再推送到远端,但是比较麻烦,不推荐使用,现在国家对于信息管理要求越来越严格,当前在 Gitee 上默认只能创建私有仓库(仅仓库成员可见),创建好之后,当仓库被审核通过后,若再想进行开源,则可以在仓库管理中进行手动设置、


[HJM@hjmlcc ~]$ ls
Makefile process.c
//使用下述指令可将远端的 Git 仓库克隆到本地、
[HJM@hjmlcc ~]$ git clone https://gitee.com/LCC11223/for_-linux_-code.git
Cloning into 'for_-linux_-code'...
//输入 Gitee 的账号和密码、
Username for 'https://gitee.com': 13386323259
Password for 'https://13386323259@gitee.com':
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (6/6), done.
[HJM@hjmlcc ~]$ ls
for_-linux_-code Makefile process.c
[HJM@hjmlcc ~]$ ll
total 12
drwxrwxr-x 3 HJM HJM 4096 Nov 7 18:26 for_-linux_-code //目录文件、
// for_-linux_-code 这就是本地的 Git 仓库(目录文件),由克隆远端的 Git 仓库得到、
-rw-rw-r-- 1 HJM HJM 80 Nov 6 15:01 Makefile
-rw-rw-r-- 1 HJM HJM 1116 Nov 6 16:06 process.c
[HJM@hjmlcc ~]$ cd for_-linux_-code
[HJM@hjmlcc for_-linux_-code]$ ls
LICENSE README.en.md README.md
[HJM@hjmlcc for_-linux_-code]$ ll
total 12
-rw-rw-r-- 1 HJM HJM 637 Nov 7 18:26 LICENSE
-rw-rw-r-- 1 HJM HJM 865 Nov 7 18:26 README.en.md
-rw-rw-r-- 1 HJM HJM 954 Nov 7 18:26 README.md
[HJM@hjmlcc for_-linux_-code]$ ls -al
total 28
drwxrwxr-x 3 HJM HJM 4096 Nov 7 18:26 .
drwx---rwx 9 HJM HJM 4096 Nov 7 18:26 ..
drwxrwxr-x 8 HJM HJM 4096 Nov 7 18:26 .git
//在当前路径下存在一个以.开头的隐藏的目录文件,这就是所谓的本地的 Git 仓库(目录文件)、
//所谓的将本地的代码同步到远端,不仅仅只是同步普通文件:LICENSE,README.en.md和README.md
//还有就是将本地的 Git 仓库中的内容同步到远端的 Git 仓库中、
-rw-rw-r-- 1 HJM HJM 270 Nov 7 18:26 .gitignore
-rw-rw-r-- 1 HJM HJM 637 Nov 7 18:26 LICENSE
-rw-rw-r-- 1 HJM HJM 865 Nov 7 18:26 README.en.md
-rw-rw-r-- 1 HJM HJM 954 Nov 7 18:26 README.md
[HJM@hjmlcc for_-linux_-code]$ tree .git
.git
|-- branches
|-- config
|-- description
|-- HEAD
|-- hooks
| |-- applypatch-msg.sample
| |-- commit-msg.sample
| |-- post-update.sample
| |-- pre-applypatch.sample
| |-- pre-commit.sample
| |-- prepare-commit-msg.sample
| |-- pre-push.sample
| |-- pre-rebase.sample
| `-- update.sample
|-- index
|-- info
| `-- exclude
|-- logs
| |-- HEAD
| `-- refs
| |-- heads
| | `-- master
| `-- remotes
| `-- origin
| `-- HEAD
|-- objects
| |-- 1b
| | `-- 63b36d648f566432eea5db256596ddbd2d513f
| |-- 25
| | `-- 9148fa18f9fb7ef58563f4ff15fc7b172339fb
| |-- 71
| | `-- 70d07d9d8c63ec3d0d2a0c6452c855585e0dbd
| |-- af
| | `-- 0ce369a0d2dbf87e87b41f72f491d5b6d99c25
| |-- f1
| | |-- 368e746a904df720529cd9eeba5c563410a1f7
| | `-- 6e18c48ed6547149694f1a2a217c1038f56d1a
| |-- info
| `-- pack
|-- packed-refs
`-- refs
|-- heads
| `-- master
|-- remotes
| `-- origin
| `-- HEAD
`-- tags
21 directories, 26 files
//本地的 Git 仓库中的内容一定不要修改,否则就会出错、
[HJM@hjmlcc for_-linux_-code]$ touch test.c
[HJM@hjmlcc for_-linux_-code]$ vim test.c
[HJM@hjmlcc for_-linux_-code]$ ls
LICENSE README.en.md README.md test.c
[HJM@hjmlcc for_-linux_-code]$ cat test.c
#include<stdio.h>
int main()
{
printf("Hello,Lcc\n");
return 0;
}
[HJM@hjmlcc for_-linux_-code]$ ll
total 16
-rw-rw-r-- 1 HJM HJM 637 Nov 8 11:02 LICENSE
-rw-rw-r-- 1 HJM HJM 865 Nov 8 11:02 README.en.md
-rw-rw-r-- 1 HJM HJM 954 Nov 8 11:02 README.md
-rw-rw-r-- 1 HJM HJM 70 Nov 8 11:05 test.c
//查看本地的 Git 仓库与远端的 Git 仓库之间的关系、
[HJM@hjmlcc for_-linux_-code]$ git status
# On branch master
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# test.c //当前有一个没有被管理的普通源文件:test.c、
nothing added to commit but untracked files present (use "git add" to track)
//三板斧:
//第一板斧:
[HJM@hjmlcc for_-linux_-code]$ git add test.c
//第二板斧:
//该操作是把普通源文件test.c添加到本地的 Git 仓库,其中,-m(message,不可省略):代表本次的提交
//日志,注意:提交日志不能乱写、
[HJM@hjmlcc for_-linux_-code]$ git commit -m "新增了一个测试代码,仅仅是一个简单的程序"
[master c90d03b] 新增了一个测试代码,仅仅是一个简单的程序
1 file changed, 6 insertions(+)
create mode 100644 test.c
//第三板斧:
[HJM@hjmlcc for_-linux_-code]$ git push
//该操作是把普通源文件test.c添加到远端的 Git 仓库、
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
//上述的警告可忽略不管、
//输入 Gitee 的账号和密码、
Username for 'https://gitee.com': 13386323259
Password for 'https://13386323259@gitee.com':
Counting objects: 4, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 400 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/LCC11223/for_-linux_-code.git
f77bd8f..c90d03b master -> master
[HJM@hjmlcc for_-linux_-code]$ clear



经过上述在线编辑的操作后,此时本地的 Git 仓库中的普通源文件 test.c 中的内容和远端的 Git仓库中的普通源文件 test.c 中的内容就不相同了,从而导致本地 Git 仓库和远端 Git 仓库中的内容就不同了、
[HJM@hjmlcc for_-linux_-code]$ clear
[HJM@hjmlcc for_-linux_-code]$ ls
LICENSE README.en.md README.md test.c
[HJM@hjmlcc for_-linux_-code]$ touch lcc.c
[HJM@hjmlcc for_-linux_-code]$ echo "lccwan" > lcc.c
[HJM@hjmlcc for_-linux_-code]$ cat lcc.c
lccwan
[HJM@hjmlcc for_-linux_-code]$ git add lcc.c
[HJM@hjmlcc for_-linux_-code]$ git commit -m "仅仅用来测试"
[master 88e5d89] 仅仅用来测试
1 file changed, 1 insertion(+), 1 deletion(-)
[HJM@hjmlcc for_-linux_-code]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
//上述的警告可忽略不管、
//输入 Gitee 的账号和密码、
Username for 'https://gitee.com': 13386323259
Password for 'https://13386323259@gitee.com':
To https://gitee.com/LCC11223/for_-linux_-code.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/LCC11223/for_-linux_-code.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first merge the remote changes (e.g.,
hint: 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[HJM@hjmlcc for_-linux_-code]$
此时,就出现了一些冲突(hint),这是因为,由于上面的在线编辑的操作,导致本地的 Git 仓库中的内容和远端 Git 仓库中的内容不一样了,但是,如果我们再想往 Gitee 上面提交新的普通文件(普通头文件或普通源文件)时,前提要保证,本地 Git 仓库中的内容和远端 Git 仓库中的内容一样才可以,否则就会出现冲突,我们只考虑往 Gitee 上面提交普通文件中的普通源文件和普通头文件,其他的一律不考虑,具体解决方法如下所示:
//让本地的 Git 仓库中的内容与远端 Git 仓库中的内容保持一样、
[HJM@hjmlcc for_-linux_-code]$ git pull
Username for 'https://gitee.com': 13386323259
Password for 'https://13386323259@gitee.com':
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://gitee.com/LCC11223/for_-linux_-code
660c252..6eba4f3 master -> origin/master
Error detected while processing /home/HJM/.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 23:
E492: Not an editor command: Plug 'fatih/vim-go'
line 30:
E185: Cannot find color scheme 'luna-term'
line 59:
E518: Unknown option: foldmethod=marker
line 142:
E518: Unknown option: foldenable
line 150:
E518: Unknown option: foldmethod=indent
line 151:
E518: Unknown option: foldlevel=99
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
line 302:
E31: No such mapping
line 307:
E492: Not an editor command: ^Iterminal
Press ENTER or type command to continue
//此时可能因为vim配置存在一些问题(不支持git)导致出现上述这些内容,直接敲回车,再进入底行/末行
//模式下输入q!,再敲回车,再进入底行/末行模式下输入q!,再敲回车,得到如下结果:
Merge made by the 'recursive' strategy.
lcc.c | 2 ++
1 file changed, 2 insertions(+)
[HJM@hjmlcc for_-linux_-code]$
//此时就默认本地的 Git 仓库中的内容与远端 Git 仓库中的内容保持一样了、
[HJM@hjmlcc for_-linux_-code]$ cat test.c
#include<stdio.h>
int main()
{
printf("Hello,Lcc\n");
printf("Hello,Hjm\n");
return 0;
}
[HJM@hjmlcc for_-linux_-code]$ git push
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
//上述的警告可忽略不管、
//输入 Gitee 的账号和密码、
Username for 'https://gitee.com': 13386323259
Password for 'https://13386323259@gitee.com':
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (5/5), 554 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
remote: Powered by GITEE.COM [GNK-6.4]
To https://gitee.com/LCC11223/for_-linux_-code.git
6eba4f3..6bd0bf2 master -> master
[HJM@hjmlcc for_-linux_-code]$ git log
commit d6d69d1c31fcd913bd7934fe0d8a9a1fa6743891
Merge: fe36cbb 5eda4f1
Author: 惠俊明 <915398909@qq.com>
Date: Tue Nov 8 11:15:30 2022 +0800
Merge branch 'master' of https://gitee.com/LCC11223/for_-linux_-code
commit fe36cbb7397f60c5b1d048f639766f6fe2efd142
Author: 惠俊明 <915398909@qq.com>
Date: Tue Nov 8 11:13:08 2022 +0800
仅仅用来测试
commit 5eda4f162682114eccec5b0cf522a1196b5d351d
Author: 惠俊明 <915398909@qq.com>
Date: Tue Nov 8 03:11:58 2022 +0000
update test.c.
再次添加日志
Signed-off-by: 惠俊明 <915398909@qq.com>
commit a6c196de4e711453d06e623b3d58ae55a7c7ed34
Author: 惠俊明 <915398909@qq.com>
Date: Tue Nov 8 11:09:40 2022 +0800
新增了一个测试代码,仅仅是一个简单的程序
commit 25613b809ff363adc777fbd19d17f5d0fa6b2cb3
Author: 惠俊明 <915398909@qq.com>
Date: Tue Nov 8 03:02:01 2022 +0000
: //输入q退出、

当首次使用 git 软件/工具/指令时,可能会提示需要设置用户名和邮箱,如下所示:
//在某一个本地的 Git 仓库中设置全部的本地的 Git 仓库的用户名: 常用、 git config --global user.name "惠俊明" //在某一个本地的 Git 仓库中设置全部的本地的 Git 仓库的邮箱: 常用、 git config --global user.email 915398909@qq.com //在某一个本地的 Git 仓库中设置当前的本地的 Git 仓库的用户名: git config user.name "惠俊明" //在某一个本地的 Git 仓库中设置当前的本地的 Git 仓库的邮箱: git config user.email 915398909@qq.com //在某一个本地的 Git 仓库中查看当前的本地的 Git 仓库的用户名和邮箱: git config user.name git config user.email
如何实现如下所示的功能:
[HJM@hjmlcc ~]$ ls Makefile process.c [HJM@hjmlcc ~]$ git clone https://gitee.com/LCC11223/for_-linux_-delete.git Cloning into 'for_-linux_-delete'... Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (10/10), done. remote: Total 11 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (11/11), done. [HJM@hjmlcc ~]$ ls for_-linux_-delete Makefile process.c [HJM@hjmlcc ~]$ cd for_-linux_-delete [HJM@hjmlcc for_-linux_-delete]$ ls LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-delete]$ mkdir 2022_11_8 [HJM@hjmlcc for_-linux_-delete]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-delete]$ cd 2022_11_8 [HJM@hjmlcc 2022_11_8]$ ls [HJM@hjmlcc 2022_11_8]$ touch lcc.c [HJM@hjmlcc 2022_11_8]$ vim lcc.c [HJM@hjmlcc 2022_11_8]$ cat lcc.c #include<stdio.h> int main() { printf("Hello,Lcc\n"); return 0; } [HJM@hjmlcc 2022_11_8]$ git add lcc.c [HJM@hjmlcc 2022_11_8]$ git commit -m "新增了一个测试代码,仅仅是一个简单的程序" [master 170320e] 新增了一个测试代码,仅仅是一个简单的程序 1 file changed, 6 insertions(+) create mode 100644 2022_11_8/lcc.c [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 447 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-delete.git 24cd5c4..170320e master -> master [HJM@hjmlcc 2022_11_8]$
关于 git 的 .gitignore 问题
[HJM@hjmlcc ~]$ clear [HJM@hjmlcc ~]$ ls Makefile process.c [HJM@hjmlcc ~]$ git clone https://gitee.com/LCC11223/for_-linux_-delete.git Cloning into 'for_-linux_-delete'... Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': remote: Enumerating objects: 37, done. remote: Counting objects: 100% (37/37), done. remote: Compressing objects: 100% (35/35), done. remote: Total 37 (delta 12), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (37/37), done. [HJM@hjmlcc ~]$ ls for_-linux_-delete Makefile process.c [HJM@hjmlcc ~]$ cd for_-linux_-delete [HJM@hjmlcc for_-linux_-delete]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-delete]$ cd 2022_11_8 [HJM@hjmlcc 2022_11_8]$ ls lcc.c [HJM@hjmlcc 2022_11_8]$ cd .. [HJM@hjmlcc for_-linux_-delete]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-delete]$ ls -al total 32 drwxrwxr-x 4 HJM HJM 4096 Nov 8 15:54 . drwx---rwx 9 HJM HJM 4096 Nov 8 15:54 .. drwxrwxr-x 2 HJM HJM 4096 Nov 8 15:54 2022_11_8 drwxrwxr-x 8 HJM HJM 4096 Nov 8 15:54 .git -rw-rw-r-- 1 HJM HJM 270 Nov 8 15:54 .gitignore -rw-rw-r-- 1 HJM HJM 637 Nov 8 15:54 LICENSE -rw-rw-r-- 1 HJM HJM 832 Nov 8 15:54 README.en.md -rw-rw-r-- 1 HJM HJM 921 Nov 8 15:54 README.md [HJM@hjmlcc for_-linux_-delete]$ vim .gitignore [HJM@hjmlcc for_-linux_-delete]$ cat .gitignore # 自己定义的: *.x *.X # Prerequisites *.d # Compiled Object files *.slo *.lo *.o *.obj # Precompiled Headers *.gch *.pch # Compiled Dynamic libraries *.so *.dylib *.dll # Fortran module files *.mod *.smod # Compiled Static libraries *.lai *.la *.a *.lib # Executables *.exe *.out *.app [HJM@hjmlcc for_-linux_-delete]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-delete]$ cd 2022_11_8 [HJM@hjmlcc 2022_11_8]$ ls lcc.c [HJM@hjmlcc 2022_11_8]$ touch lcc.x [HJM@hjmlcc 2022_11_8]$ touch lcc.X [HJM@hjmlcc 2022_11_8]$ touch lcc.y [HJM@hjmlcc 2022_11_8]$ touch lcc.Y [HJM@hjmlcc 2022_11_8]$ ls lcc.c lcc.x lcc.X lcc.y lcc.Y [HJM@hjmlcc 2022_11_8]$ git add . [HJM@hjmlcc 2022_11_8]$ git commit -m "测试.gitignore" [master 1a628cd] 测试.gitignore 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 2022_11_8/lcc.Y create mode 100644 2022_11_8/lcc.y [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 6, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 348 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-delete.git 8d1397f..1a628cd master -> master [HJM@hjmlcc 2022_11_8]$ git status # 0n branch master nothing to commit , working directory clean [HJM@hjmlcc 2022_11_8]$
对于 Git Version 1.x :
一:
[HJM@hjmlcc ~]$ ls Makefile process.c [HJM@hjmlcc ~]$ git clone https://gitee.com/LCC11223/for_-linux_-code.git Cloning into 'for_-linux_-code'... Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': remote: Enumerating objects: 75, done. remote: Counting objects: 100% (75/75), done. remote: Compressing objects: 100% (65/65), done. remote: Total 75 (delta 24), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (75/75), done. [HJM@hjmlcc ~]$ ls for_-linux_-code Makefile process.c [HJM@hjmlcc ~]$ cd for_-linux_-code [HJM@hjmlcc for_-linux_-code]$ ls LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ mkdir 2022_11_8 [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8 [HJM@hjmlcc 2022_11_8]$ ls [HJM@hjmlcc 2022_11_8]$ touch lcc.c [HJM@hjmlcc 2022_11_8]$ vim lcc.c [HJM@hjmlcc 2022_11_8]$ cat lcc.c woailiuchenchen [HJM@hjmlcc 2022_11_8]$ git add lcc.c [HJM@hjmlcc 2022_11_8]$ git commit -m "仅仅用来测试" [master 5b2372f] 仅仅用来测试 1 file changed, 1 insertion(+) create mode 100644 2022_11_8/lcc.c [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 350 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git 4fb04d9..5b2372f master -> master [HJM@hjmlcc 2022_11_8]$
[HJM@hjmlcc 2022_11_8]$ ls lcc.c [HJM@hjmlcc 2022_11_8]$ vim lcc.c [HJM@hjmlcc 2022_11_8]$ cat lcc.c HJMailiuchenchen [HJM@hjmlcc 2022_11_8]$ touch hjm.c [HJM@hjmlcc 2022_11_8]$ echo "lcc" > hjm.c [HJM@hjmlcc 2022_11_8]$ ls hjm.c lcc.c [HJM@hjmlcc 2022_11_8]$ cat hjm.c lcc [HJM@hjmlcc 2022_11_8]$ git add . [HJM@hjmlcc 2022_11_8]$ git commit -m "测试指令git add ." [master bd19d9b] 测试指令git add . 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 2022_11_8/hjm.c [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 8, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 379 bytes | 0 bytes/s, done. Total 5 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git 5b2372f..bd19d9b master -> master [HJM@hjmlcc 2022_11_8]$
二:
[HJM@hjmlcc ~]$ ls for_-linux_-code Makefile process.c [HJM@hjmlcc ~]$ cd for_-linux_-code [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8 [HJM@hjmlcc 2022_11_8]$ ls hjm.c lcc.c [HJM@hjmlcc 2022_11_8]$ vim lcc.c //修改普通源文件lcc.c中的内容、 [HJM@hjmlcc 2022_11_8]$ rm hjm.c //删除普通源文件hjm.c、 [HJM@hjmlcc 2022_11_8]$ ls lcc.c [HJM@hjmlcc 2022_11_8]$ cat lcc.c HJMailiuchenchen521 [HJM@hjmlcc 2022_11_8]$ git add -u [HJM@hjmlcc 2022_11_8]$ git commit -m "测试git add -u" [master 463dd4c] 测试git add -u 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 2022_11_8/hjm.c [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 7, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 335 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git bd19d9b..463dd4c master -> master [HJM@hjmlcc 2022_11_8]$[HJM@hjmlcc 2022_11_8]$ ls lcc.c [HJM@hjmlcc 2022_11_8]$ touch LCC.c [HJM@hjmlcc 2022_11_8]$ echo "hjm" > LCC.c [HJM@hjmlcc 2022_11_8]$ ls lcc.c LCC.c [HJM@hjmlcc 2022_11_8]$ git add -u [HJM@hjmlcc 2022_11_8]$ git commit -m "测试指令git add -u" # On branch master //#分支机构主管 # Untracked files: //#未跟踪的文件: # (use "git add <file>..." to include in what will be committed) //#(使用“git添加<文件> ...”包括在将要提交的内容中) # # LCC.c nothing added to commit but untracked files present (use "git add" to track) //提交时没有添加任何内容,但存在未跟踪的文件(使用“git add”进行跟踪)、 [HJM@hjmlcc 2022_11_8]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Everything up-to-date //一切都是最新的 [HJM@hjmlcc 2022_11_8]$
三:
[HJM@hjmlcc ~]$ ls Makefile process.c [HJM@hjmlcc ~]$ git clone https://gitee.com/LCC11223/for_-linux_-code.git Cloning into 'for_-linux_-code'... remote: Enumerating objects: 91, done. remote: Counting objects: 100% (91/91), done. remote: Compressing objects: 100% (75/75), done. remote: Total 91 (delta 28), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (91/91), done. [HJM@hjmlcc ~]$ ls for_-linux_-code Makefile process.c [HJM@hjmlcc ~]$ cd for_-linux_-code [HJM@hjmlcc for_-linux_-code]$ ls LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ mkdir 2022_11_8_1 [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8_1 [HJM@hjmlcc 2022_11_8_1]$ ls [HJM@hjmlcc 2022_11_8_1]$ touch lcc.c hjm.c [HJM@hjmlcc 2022_11_8_1]$ echo "lcc" > lcc.c [HJM@hjmlcc 2022_11_8_1]$ echo "hjm" > hjm.c [HJM@hjmlcc 2022_11_8_1]$ cat lcc.c lcc [HJM@hjmlcc 2022_11_8_1]$ cat hjm.c hjm [HJM@hjmlcc 2022_11_8_1]$ git add . [HJM@hjmlcc 2022_11_8_1]$ git commit -m "测试指令git add ." [master b0fea76] 测试指令git add . 2 files changed, 2 insertions(+) create mode 100644 2022_11_8_1/hjm.c create mode 100644 2022_11_8_1/lcc.c [HJM@hjmlcc 2022_11_8_1]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 6, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 383 bytes | 0 bytes/s, done. Total 5 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git ca6a9bd..b0fea76 master -> master [HJM@hjmlcc 2022_11_8_1]$
[HJM@hjmlcc 2022_11_8_1]$ ls hjm.c lcc.c [HJM@hjmlcc 2022_11_8_1]$ cd .. [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ mkdir 2022_11_8_2 [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 2022_11_8_2 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8_2 [HJM@hjmlcc 2022_11_8_2]$ ls [HJM@hjmlcc 2022_11_8_2]$ touch lh.c [HJM@hjmlcc 2022_11_8_2]$ echo "11223" > lh.c [HJM@hjmlcc 2022_11_8_2]$ ls lh.c [HJM@hjmlcc 2022_11_8_2]$ cd .. [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 2022_11_8_2 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8_1 [HJM@hjmlcc 2022_11_8_1]$ ls hjm.c lcc.c [HJM@hjmlcc 2022_11_8_1]$ git add -A :/ [HJM@hjmlcc 2022_11_8_1]$ git commit -m "测试指令git add -A :/" [master dac8cbe] 测试指令git add -A :/ 1 file changed, 1 insertion(+) create mode 100644 2022_11_8_2/lh.c [HJM@hjmlcc 2022_11_8_1]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 5, done. Delta compression using up to 2 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (4/4), 347 bytes | 0 bytes/s, done. Total 4 (delta 1), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git b0fea76..dac8cbe master -> master [HJM@hjmlcc 2022_11_8_1]$
[HJM@hjmlcc 2022_11_8_1]$ clear [HJM@hjmlcc 2022_11_8_1]$ pwd /home/HJM/for_-linux_-code/2022_11_8_1 [HJM@hjmlcc 2022_11_8_1]$ ls hjm.c lcc.c [HJM@hjmlcc 2022_11_8_1]$ cat lcc.c lcc [HJM@hjmlcc 2022_11_8_1]$ echo "hjm" >> lcc.c //修改普通源文件lcc.c中的内容、 [HJM@hjmlcc 2022_11_8_1]$ cat lcc.c lcc hjm [HJM@hjmlcc 2022_11_8_1]$ rm hjm.c //删除普通源文件hjm.c、 [HJM@hjmlcc 2022_11_8_1]$ ls lcc.c [HJM@hjmlcc 2022_11_8_1]$ cat lcc.c lcc hjm [HJM@hjmlcc 2022_11_8_1]$ pwd /home/HJM/for_-linux_-code/2022_11_8_1 [HJM@hjmlcc 2022_11_8_1]$ cd .. [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 2022_11_8_2 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8_2 [HJM@hjmlcc 2022_11_8_2]$ ls lh.c [HJM@hjmlcc 2022_11_8_2]$ touch lcc.c [HJM@hjmlcc 2022_11_8_2]$ echo "lcc" > lcc.c [HJM@hjmlcc 2022_11_8_2]$ cat lcc.c lcc [HJM@hjmlcc 2022_11_8_2]$ cd .. [HJM@hjmlcc for_-linux_-code]$ pwd /home/HJM/for_-linux_-code [HJM@hjmlcc for_-linux_-code]$ ls 2022_11_8_1 2022_11_8_2 LICENSE README.en.md README.md [HJM@hjmlcc for_-linux_-code]$ cd 2022_11_8_1 [HJM@hjmlcc 2022_11_8_1]$ ls lcc.c [HJM@hjmlcc 2022_11_8_1]$ git add -A :/ [HJM@hjmlcc 2022_11_8_1]$ git commit -m "测试指令git add -A :/" [master 53c6418] 测试指令git add -A :/ 3 files changed, 2 insertions(+), 1 deletion(-) delete mode 100644 2022_11_8_1/hjm.c create mode 100644 2022_11_8_2/lcc.c [HJM@hjmlcc 2022_11_8_1]$ git push warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To squelch this message and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information. (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode 'current' instead of 'simple' if you sometimes use older versions of Git) Username for 'https://gitee.com': 13386323259 Password for 'https://13386323259@gitee.com': Counting objects: 9, done. Delta compression using up to 2 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 552 bytes | 0 bytes/s, done. Total 5 (delta 0), reused 0 (delta 0) remote: Powered by GITEE.COM [GNK-6.4] To https://gitee.com/LCC11223/for_-linux_-code.git b0fea76..dac8cbe master -> master [HJM@hjmlcc 2022_11_8_1]$
四:
远端的 Git 仓库如何开源:
注意:
不要在 Gitee 上新建远端的 Git 仓库之后立马开源,最好要等到在该远端的 Git 仓库中提交一些内容之后,再进行开源,实在不行改一下 Readme 、
远端的 Git 仓库如何删除:
前置步骤我们都操作完了,这篇开始介绍jenkins的集成。话不多说,看操作1、登录进入jenkins后会让你选择安装插件,选择第一个默认的就行。安装完成后设置账号密码,重新登录。2、配置JDK和Git都需要执行路径,所以需要先把执行路径找到,先进入服务器的docker容器,2.1JDK的路径root@69eef9ee86cf:/usr/bin#echo$JAVA_HOME/usr/local/openjdk-82.2Git的路径root@69eef9ee86cf:/#whichgit/usr/bin/git3、先配置JDK和Git。点击:ManageJenkins>>GlobalToolCon
文章目录git常用命令(简介,详细参数往下看)Git提交代码步骤gitpullgitstatusgitaddgitcommitgitpushgit代码冲突合并问题方法一:放弃本地代码方法二:合并代码常用命令以及详细参数gitadd将文件添加到仓库:gitdiff比较文件异同gitlog查看历史记录gitreset代码回滚版本库相关操作远程仓库相关操作分支相关操作创建分支查看分支:gitbranch合并分支:gitmerge删除分支:gitbranch-ddev查看分支合并图:gitlog–graph–pretty=oneline–abbrev-commit撤消某次提交git用户名密码相关配置g
我使用Jekyll运行博客,并认为我会解决RedcarpetMarkdown解释器,因为它是developedandusedbyGitHub.好吧,我只是碰巧遇到了一个错误,去检查问题,然后foundthis.Maintainersays,"Asyouprobablyhavenoticed(harharharhar)Idon'thavetimetomaintainRedcarpetanymore.It'snotapriorityforme(IfindMarkdownthoroughlyboring)andit'snotapriorityforGitHub,becausewenolong
关于如何使用git设置类似Dropbox的服务,您有什么建议吗?您认为git是解决此问题的合适工具吗?我在考虑使用git+rush解决方案,你觉得怎么样? 最佳答案 检查这个开源项目:https://github.com/hbons/SparkleShare来自项目的自述文件:Howdoesitwork?SparkleSharecreatesaspecialfolderonyourcomputer.Youcanaddremotelyhostedfolders(or"projects")tothisfolder.Theseprojec
我编写了一个非常简单的“部署”脚本,作为我的裸git存储库中的post-updateHook运行。变量如下livedomain=~/mydomain.comstagingdomain=~/stage.mydomain.comgitrepolocation=~/git.mydomain.com/thisrepo.git(bare)core=~/git.mydomain.com/thisrepo.gitcore==addedremoteintoeachlive&stagegitslive和stage都初始化了gitrepos(非裸),我已经将我的裸仓库作为远程添加到它们中的每一个(名为co
我正在安装gitlabhq,并且在Gemfile中有对某些资源的“git://...”的引用。但是,我在公司防火墙后面,所以我必须使用http://。我可以手动编辑Gemfile,但我想知道是否有另一种方法告诉bundler使用http://作为git存储库? 最佳答案 您可以通过运行gitconfig--globalurl."https://".insteadOfgit://或通过将以下内容添加到~/.gitconfig:[url"https://"]insteadOf=git://
我们正在使用Vagrant进行部署,我们最终希望将此集群部署在Rackspace上。vagrant-rackspace插件是一个自然的选择,但它有一些错误,这些错误未包含在最新的0.1.1版本中(notablythatvagrantprovisiondoesn'twork)。我已经在我的personalfork中解决了这个问题通过合并其他人的工作来对存储库进行改造。是否可以从github安装vagrant插件?显而易见的事情没有奏效:[unix]$vagrantplugininstallvagrant-rackspace--plugin-sourcehttps://github.com
Activeadmingem已添加到我的rails项目中,但每次我尝试安装railsgactive_admin:install时,我都会收到类似的错误git://github.com/activeadmin/activeadmin.git(atmaster)isnotyetcheckedout.Runbundleinstallfirst.我肯定在运行“railsgactive_admin:install”之前运行了bundle。运行“bundleshow”后,我看到我已将“*activeadmin(1.0.0.pre3f916d6)”添加到我的项目中,但不断收到此错误消息。我的gem文
我有一个使用Jekyll托管在GitHub上的静态网站。问题是,我真的不需要master分支,因为存储库唯一包含的是网站。这样我就必须gitcheckoutgh-pages,然后gitmergemaster,然后gitpushorigingh-pages。有什么简单的方法可以摆脱gh-pages分支并直接从master推送? 最佳答案 Theproblemis,Idon'treallyneedthemasterbranch,astheonlythingtherepositorycontainsisthewebsite.Isthere
Linux操作系统——网络配置与SSH远程安装完VMware与系统后,需要进行网络配置。第一个目标为进行SSH连接,可以从本机到VMware进行文件传送,首先需要进行网络配置。1.下载远程软件首先需要先下载安装一款远程软件:FinalShell或者xhell7FinalShellxhell7FinalShell下载:Windows下载http://www.hostbuf.com/downloads/finalshell_install.exemacOS下载http://www.hostbuf.com/downloads/finalshell_install.pkg2.配置CentOS网络安装好