Directorio de artículos
-
-
- 1. Acerca de gitee
- Dos, instala git
- Tres, inicia sesión en gitee
- Cuatro, generar clave pública SSH
- Cinco, configurar la clave pública SSH
- Seis, crea un proyecto
- Siete, clona el almacén al local.
- 8. Asociar proyectos locales a almacenes remotos
- Nueve, agrega archivos
- 10. Ejecute comandos git y envíe archivos
- 11. Eliminar el almacén
- Doce comandos git de uso común
-
1. Acerca de gitee
gitee
(Nombre chino: Code Cloud, nombre original Git@OSC
) es git
un servicio de alojamiento de código lanzado por Open Source China .
La GitHub
velocidad de acceso doméstico es relativamente lenta. Si desea alojar su propio código en la nube, gitee
es una buena opción. El 鸿蒙2.0
código fuente de Huawei también está en la gitee
parte superior.
Dos, instala git
Para usarlo gitee
, primero debe instalar la git
herramienta.
git
Descarga de la herramienta: https://git-scm.com/downloads Una vez
completada la instalación, ingrese la versión que git --version
se puede ver en la línea de comando git
.
El menú del botón derecho también aparecerá el menú correspondiente.
Tres, inicia sesión en gitee
Primero gitee
ingresamos a la cuenta registrada e iniciamos sesión.
gitee
Sitio web oficial: https://gitee.com/
Cuatro, generar clave pública SSH
Debido a nuestros git
almacenes locales y el gitee
transporte entre el almacén a través de SSH
cifrado, necesitamos configurar la SSH
clave pública.
Nota: una vez instalada la
git
herramienta, puede utilizar elssh
comando
Abra la cmd
lí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.
Siga las indicaciones para completarEntrar tres vecesGenerar ssh key
.
Puede ver la id_rsa.pub
ruta 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
para ver la SSH
clave pública, que se utilizará a continuación SSH
.
Cinco, configurar la clave pública SSH
En el gitee
sitio web, haga 设置
clic en SSH
el
título de la clave pública de entrada pública, simplemente copie la SSH
clave pública en el cuadro y haga clic en Aceptar
configuración exitosa
Seis, crea un proyecto
Haga clic en la esquina superior derecha del +
número, el nuevo almacén a
continuación, complete el almacén de información y finalmente haga clic en Crear en.
Siete, clona el almacén al local.
Haga clic en 克隆/下载
, luego haga clic en el enlace de SSH
asignació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
Git Bash Here
git clone 刚刚的git链接
git clone [email protected]:linxinfa/mytest.git
Después de tener éxito, los README
archivos clonados se pueden ver en el directorio local .
8. Asociar proyectos locales a almacenes remotos
A veces, primero podemos tener el archivo de proyecto localmente y luego gitee
crear el almacén en él.
En este caso, el comando se puede usar en la biblioteca local git remote add
y gitee
asociarlo 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 add
se 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 origin
la biblioteca remota, esta vez, puede usar git remote -v
para 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.txt
archivo localmente, de la siguiente manera, agregue un archivo.
10. Ejecute comandos git y envíe archivos
Abierta git
, la ejecución git
de add
, commit
, push
comando, se puede subir archivos locales a un repositorio remoto.
Nota: git
Consulte el final del artículo para conocer los comandos de uso común .
Actualice la gitee
página, puede ver que el archivo local se ha subido a `` gitee ''
11. Eliminar el almacén
Haga clic para 管理
eliminar el almacén e ingrese la contraseña cuando se le solicite
Doce comandos git de uso común
git
Comandos 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 git
pueden ingresar más comandos para git --help
ver
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.