在 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 仓库如何删除: