gitee使用教程,创建项目仓库并上传代码

2023-05-28 0 638

一、有关gitee

gitee(英文名:码云 ,本名 Git@OSC)是开放源码我国面世的如前所述git的标识符代销服务工程项目。 亚洲地区访问GitHub速度很慢,假如想代销他们的标识符到用户端,gitee是个极好的优先选择,华为的韩化英2.0源代码也是放到gitee上的。

二、加装git

要采用gitee,须要先加装git辅助工具。 git辅助工具浏览:https://git-scm.com/downloads

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

加装顺利完成后,在实用性文件输出git –version能查阅到git的版。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

滑鼠辅助工具栏也会再次出现适当的辅助工具栏。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

三、登入gitee

他们先在 gitee上注册登记帐号并登入。 gitee官方网站:https://gitee.com/

四、聚合SSH私钥

虽然他们的邻近地区 git库房和 gitee库房间的数据传输是透过SSH身份验证的,因此他们须要实用性SSH私钥。

注:加装了git辅助工具,就能采用ssh指示

关上cmd实用性文件,输出指示

sshkeygen t rsa C [email protected] 1
注意:这儿的[email protected]只是聚合的 sshkey 的名称,并不约束或要求具体命名为某个邮箱。
gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

按照提示顺利完成三次回车,即可聚合ssh key。 能看到,他们聚合的私钥文件id_rsa.pub路径:C:\User\Adminstrator/.ssh/id_rsa.pub 进入该目录用文本编辑器关上

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

即可看到SSH私钥,下文中将会用到这个SSH私钥。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

五、实用性SSH私钥

在gitee网站点击设置

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

点击SSH私钥

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

输出私钥标题,拷贝刚刚的SSH私钥到框中,点击确定

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

实用性成功

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

六、建立一个工程项目

点击右上角的 +号,新建库房

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

如下,填写库房信息,最后点击建立即可。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

七、克隆库房到邻近地区

点击克隆/浏览,然后点击SSH,复制git链接

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

接着,在邻近地区目录空白处滑鼠辅助工具栏,点击Git Bash Here。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

输出git clone 刚刚的git链接,如下

git clone [email protected]:linxinfa/mytest.git 1
gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

成功后,邻近地区目录即可看到克隆下来的README文件。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

八、关联邻近地区工程到远程库房

有时候,他们可能是先在邻近地区有了工程文件,然后再在gitee上建立库房的。 此时,可在邻近地区库上采用指示 git remote add把它和 gitee的远程库关联,如下

git remote add origin git@gitee.com:linxinfa/mytest.git 1

假如在采用指示 git remote add时报错:

git remote add origin git@gitee.com:linxinfa/mytest.git fatal: remote origin already exists. 12

说明邻近地区库已经关联了一个名叫 origin的远程库,此时,能先用git remote -v查阅远程库信息:

git remote v origin git@gitee.com:linxinfa/mytest.git (fetch) origin git@gitee.com:linxinfa/mytest.git (push) 123

他们能删除已有的远程库

git remote rm origin 1

再关联远程库

git remote add origin git@gitee.com:linxinfa/mytest.git 1

九、添加文件

在邻近地区添加文件,如下,添加一个AddFileTest.txt文件。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

十、执行git指示,提交文件

关上git,执行git的add、commit、push指示,即可将邻近地区文件上载到远程库房。 注:常用的git指示见文章最后面。

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

刷新gitee页面,即可看到邻近地区文件已经上载到`gitee上了

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

十一、删除库房

点击管理

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

点击删除库房,根据提示输出密码即可

gitee使用教程,创建项目仓库并上传代码
在这儿填入相片叙述

十二、常用的git指示

常用的git指示

git init #把当前目录变成git能管理的库房 git clone git地址 #克隆工程项目 git add readme.txt #添加一个文件,也能添加文件夹 git add A #添加全部文件 git rm test.txt #删除一个文件,也能删除文件夹 git commit a m some commit #提交修改 git status #查阅是否还有未提交 git log #查阅最近日志 git reset hard HEAD^ #版回退一个版 git reset hard HEAD^^ #版回退两个版 git reset hard HEAD~100 #版回退多个版 git remote add origin +地址 #远程库房的提交(第一次链接) git push u origin master #库房关联 git push #远程库房的提交(第二次及之后) git fetch git tag xxx #打tag git tag #显示所有tag git push tag #提交tag git branch a #显示所有分支 git checkout 分支名 #切换分支 git merge git分支 #合并分支 123456789101112131415161718192021
gitee使用教程,创建项目仓库并上传代码
请添加相片叙述
gitee使用教程,创建项目仓库并上传代码
请添加相片叙述

更多的git指示,能输出git –help查阅,或者访问git指示手册:https://git-scm.com/docs

git help usage: git [version] [help] [C <path>] [c <name>=<value>] [execpath[=<path>]] [htmlpath] [manpath] [infopath] [p | paginate | P | nopager] [noreplaceobjects] [bare] [gitdir=<path>] [worktree=<path>] [namespace=<name>] <command> [<args>] These are common Git commands used in various situations: start a working area (see also: git help tutorial) clone Clone a repository into a new directory init Create an empty Git repository or reinitialize an existing one work on the current change (see also: git help everyday) add Add file contents to the index mv Move or rename a file, a directory, or a symlink restore Restore working tree files rm Remove files from the working tree and from the index sparsecheckout Initialize and modify the sparsecheckout examine the history and state (see also: git help revisions) bisect Use binary search to find the commit that introduced a bug diff Show changes between commits, commit and working tree, etc grep Print lines matching a pattern log Show commit logs show Show various types of objects status Show the working tree status grow, mark and tweak your common history branch List, create, or delete branches commit Record changes to the repository merge Join two or more development histories together rebase Reapply commits on top of another base tip reset Reset current HEAD to the specified state switch Switch branches tag Create, list, delete or verify a tag object signed with GPG collaborate (see also: git help workflows) fetch Download objects and refs from another repository pull Fetch from and integrate with another repository or a local branch push Update remote refs along with associated objects git help a and git help g list available subcommands and some concept guides. See git help <command> or git help <concept> to read about a specific subcommand or concept. See git help git for an overview of the system. 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647gitee采用讲义,建立工程项目库房并上载标识符

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务