tutorial de uso de gitee, crear almacén de proyectos y cargar código

1. Acerca de gitee

gitee(Nombre chino: Code Cloud, nombre original Git@OSC) es gitun servicio de alojamiento de código lanzado por Open Source China .
La GitHubvelocidad de acceso doméstico es relativamente lenta. Si desea alojar su propio código en la nube, giteees una buena opción. El 鸿蒙2.0código fuente de Huawei también está en la giteeparte superior.

Dos, instala git

Para usarlo gitee, primero debe instalar la githerramienta.
gitDescarga de la herramienta: https://git-scm.com/downloads Una vez
Inserte la descripción de la imagen aquí
completada la instalación, ingrese la versión que git --versionse puede ver en la línea de comando git.
Inserte la descripción de la imagen aquí

El menú del botón derecho también aparecerá el menú correspondiente.
Inserte la descripción de la imagen aquí

Tres, inicia sesión en gitee

Primero giteeingresamos a la cuenta registrada e iniciamos sesión.
giteeSitio web oficial: https://gitee.com/

Cuatro, generar clave pública SSH

Debido a nuestros gitalmacenes locales y el giteetransporte entre el almacén a través de SSHcifrado, necesitamos configurar la SSHclave pública.

Nota: una vez instalada la githerramienta, puede utilizar el sshcomando

Abra la cmdlínea de comando e ingrese el comando

ssh-keygen -t rsa -C "[email protected]"

Nota: Este es [email protected]solo el nombre de la clave ssh generada y no restringe ni requiere un nombre específico para un buzón.

Inserte la descripción de la imagen aquí
Siga las indicaciones para completarEntrar tres vecesGenerar ssh key.
Puede ver la id_rsa.pubruta del archivo de clave pública que generamos : C:\User\Adminstrator/.ssh/id_rsa.pub
ingrese al directorio y ábralo con un editor de texto
Inserte la descripción de la imagen aquí
para ver la SSHclave pública, que se utilizará a continuación SSH.
Inserte la descripción de la imagen aquí

Cinco, configurar la clave pública SSH

En el giteesitio web, haga 设置
Inserte la descripción de la imagen aquí
clic en SSHel
Inserte la descripción de la imagen aquí
título de la clave pública de entrada pública, simplemente copie la SSHclave pública en el cuadro y haga clic en Aceptar
Inserte la descripción de la imagen aquí
configuración exitosa
Inserte la descripción de la imagen aquí

Seis, crea un proyecto

Haga clic en la esquina superior derecha del +número, el nuevo almacén a
Inserte la descripción de la imagen aquí
continuación, complete el almacén de información y finalmente haga clic en Crear en.
Inserte la descripción de la imagen aquí

Siete, clona el almacén al local.

Haga clic en 克隆/下载, luego haga clic en el enlace de SSHasignación Siguiente, haga clic con el botón derecho en el menú en el espacio en blanco del directorio local y haga clic en . Ingrese de la siguiente maneragit
Inserte la descripción de la imagen aquí
Git Bash Here
Inserte la descripción de la imagen aquí
git clone 刚刚的git链接

git clone [email protected]:linxinfa/mytest.git

Inserte la descripción de la imagen aquí
Después de tener éxito, los READMEarchivos clonados se pueden ver en el directorio local .
Inserte la descripción de la imagen aquí

8. Asociar proyectos locales a almacenes remotos

A veces, primero podemos tener el archivo de proyecto localmente y luego giteecrear el almacén en él.
En este caso, el comando se puede usar en la biblioteca local git remote addy giteeasociarlo con una biblioteca remota de la siguiente manera

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

Si usa el comando que git remote addse le da:

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

NOTA La biblioteca local se ha asociado con un nombre de originla biblioteca remota, esta vez, puede usar git remote -vpara ver la información de una biblioteca remota:

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

Podemos eliminar la biblioteca remota existente

git remote rm origin

Vuelva a asociar la biblioteca remota

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

Nueve, agrega archivos

Agregue un AddFileTest.txtarchivo localmente, de la siguiente manera, agregue un archivo.
Inserte la descripción de la imagen aquí

10. Ejecute comandos git y envíe archivos

Abierta git, la ejecución gitde add, commit, pushcomando, se puede subir archivos locales a un repositorio remoto.
Nota: gitConsulte el final del artículo para conocer los comandos de uso común .
Inserte la descripción de la imagen aquí
Actualice la giteepágina, puede ver que el archivo local se ha subido a `` gitee ''
Inserte la descripción de la imagen aquí

11. Eliminar el almacén

Haga clic para 管理
Inserte la descripción de la imagen aquí
eliminar el almacén e ingrese la contraseña cuando se le solicite
Inserte la descripción de la imagen aquí

Doce comandos git de uso común

gitComandos de uso común

git init                        #把当前目录变成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                        #远程仓库的提交(第二次及之后)

Se gitpueden ingresar más comandos para git --helpver

git --help
usage: git [--version] [--help] [-C <path>] [-c <name>=<value>]
           [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
           [-p | --paginate | -P | --no-pager] [--no-replace-objects] [--bare]
           [--git-dir=<path>] [--work-tree=<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
   sparse-checkout   Initialize and modify the sparse-checkout

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.

Supongo que te gusta

Origin blog.csdn.net/linxinfa/article/details/108709835
Recomendado
Clasificación