Instalar GIT
cesar@developerWEB:/var/www$ sudo apt-get install git
cesar@developerWEB:/var/www$ sudo apt-get install git-core
Configuramos las variables
cesar@developerWEB:/var/www$ git config --global user.name 'Cesar Morones Sanchez'
cesar@developerWEB:/var/www$ git config --global user.email 'cesar.morones1@gmail.com'
Generamos un par de llaves
cesar@developerWEB:/var/www$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/cesar/.ssh/id_rsa):
/home/cesar/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/cesar/.ssh/id_rsa.
Your public key has been saved in /home/cesar/.ssh/id_rsa.pub.
The key fingerprint is:
34:51:aa:47:d2:02:74:d1:7c:dc:5d:bb:32:69:1a:f4 cesar@developerWEB
The key's randomart image is:
+--[ RSA 2048]----+
| .o o+.o.. . ..|
| o .ooo . . .|
| o *. . . |
| * .. . . .|
| . S . E . |
| . + o |
| . |
| |
| |
+-----------------+
Una vez que tenemos la llave hay que ponerla en github en
Clonamos una carpeta de hithub a nuestra maquina
cesar@developerWEB:/var/www/clone$ sudo git clone https://github.com/cmorones/Sfotipy.git
[sudo] password for cesar:
Cloning into 'Sfotipy'...
remote: Counting objects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
checamos el status
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
nothing to commit (working directory clean)
Creamos dos archivos
cesar@developerWEB:/var/www/clone/Sfotipy$ touch hola.txt hola2.txt
checamos el sttaus y vemos que ya tenemos dos archivos nuevos
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: README.md
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# hola.txt
# hola2.txt
no changes added to commit (use "git add" and/or "git commit -a")
Los agregamos
cesar@developerWEB:/var/www/clone/Sfotipy$ git add --all
cesar@developerWEB:/var/www/clone/Sfotipy$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: README.md
# new file: hola.txt
# new file: hola2.txt
Con este comando desagregammos
cesar@developerWEB:/var/www/clone/Sfotipy$ git reset
Y le damos commit
#
cesar@developerWEB:/var/www/clone/Sfotipy$ git commit -m 'añadi dos archivos'
[master e3a7f8c] añadi dos archivos
0 files changed
mode change 100644 => 100755 README.md
create mode 100755 hola.txt
create mode 100755 hola2.txt
Este comando se usa solo la primera vez que hacemos un push y significa que vamos a subir los archivos a github
cesar@developerWEB:/var/www/clone/Sfotipy$ git push -u origin master
Username for 'https://github.com': cmorones
Password for 'https://cmorones@github.com':
To https://github.com/cmorones/Sfotipy.git
a2b33ad..e3a7f8c master -> master
Branch master set up to track remote branch master from origin.

No hay comentarios:
Publicar un comentario