当前位置: 首页 > 后端技术 > Java

GIT-创建仓库

时间:2023-04-01 15:37:53 Java

创建远程仓库,首先在码云中创建一个仓库,创建后获取这个仓库的地址:https://gitee.com/codeyuany/g...全局设置可以先在自己的本地环境中设置一些个人信息gitconfig--globaluser.name"yong.yuan"gitconfig--globaluser.email"1218639030@qq.com"设置完成后,可以通过一些命令查看relatedtoconfig查看已经配置的信息。[root@supman~]#gitconfigusage:gitconfig[options]配置文件位置--global使用全局配置文件--system使用系统配置文件--local使用存储库配置文件-f,--file使用给定配置文件--blob从给定的blobobjectAction中读取配置--getgetvalue:name[value-regex]--get-allgetallvalues:key[value-regex]--get-regexpgetvaluesforregexp:name-regex[value-regex]--replace-all替换所有匹配的变量:namevalue[value_regex]--add添加一个新变量:namevalue--unset删除一个变量:name[value-regex]--unset-all删除所有匹配项:name[value-regex]--rename-section重命名部分:old-namenew-name--remove-section删除一个部分:name-l,--listlistall-e,--编辑打开编辑器--get-color找到配置的颜色:[default]--get-colorbool找到颜色设置:[stdout-is-tty]Type--boolvalueis"true"or"false"--int值是十进制数--bool-or-int值是--bool或--int--path值是一个路径(文件或目录名)其他-z,--null终止值以NULbyte--includesrespectincludedirectivesonlookup比如获取一个配置列表[root@supman~]#gitconfig-luser.name=yong.yuanuser.email=1218639030@qq.com单独获取一个配置[root@supman~]#gitconfig--getuser.nameyong.yuan初始化仓库创建文件夹,初始化本地仓库,添加远程仓库-remoteremote,originsource[root@supman~]#mkdirgit[root@supman~]#cdgit[root@supmangit]#gitinit在/root/git/.git/[root@supmangit]#gitremoteaddorigin初始化空的Git仓库https://gitee.com/codeyuany/git.git初始化仓库后我们将在文件夹[root@supmangit]#ls但实际上文件夹中有一个隐藏的.git文件[root@supmangit]#ls-altotal12drwxr-xr-x3rootroot4096Aug3120:57.dr-xr-x---。9rootroot4096Aug3120:56..drwxr-xr-x7rootroot4096Aug3120:57.git这个文件包含各种git信息。删除这个.git文件后,这个文件夹也是普通文件夹[root@supmangit]#cd.git[root@supman.git]#lsbranchesconfigdescriptionHEADhooksinfoobjectsrefs使用gitremote-v查看远程本地仓库关联的仓库信息,就是我们刚刚添加的远程仓库[root@supman.git]#gitremote-voriginhttps://gitee.com/codeyuany/git.git(fetch)originhttps://gitee.com/codeyuany/git.git(推送)