| 
	
		|  Autor | Tema: Git en GNU/Linux tengo problemas y dudas :(  (Leído 6,260 veces) |  
	| 
			| 
					
						| Diabliyo 
								       
								
								 Desconectado 
								Mensajes: 1.441
								
								 
								shell# _
								
								
								
								
								
								     | 
 
Buenas... Me he instalado localmente el GIT para mantener bien organizados mis proyectos, esto con la finalidad de subir mis cambios a mi Servidor Dedicado (tambien he instalado GIT igual que en mi Equipo Local). En si el proceso de instalacion es sencillo, simplemente se compilan las fuentes y ya esta funcionando... Para tener mejor organizado mi equi Local, he creado un directorio (mas NO un usuario) en /home/, llamada: git (/home/git), dentro pongo mis proyectos, asi: OJO:shell# cd /home/git/shell# mkdir proyecto1.git
 shell# cd proyecto1.git/
 shell# git init
 shell# echo "prueba" > dato.txt
 shell# git add .
 todo lo realizo como ROOT. Tambien configure mi Apache para visualizar el git: http://localhost/git ...MI PROBLEMA  es que no se como puedo por ejemplo, con mi cuenta de usuario normal, una vez que he creado mis repositorios por ejemplo en: /home/miusuario/Documentos/git/proyectA.git , como puedo subirlo a mi Equipo Local ?... Intente asi: # OJO: soy usuario comun aqui, NO soy root
 shell$ cd /home/miusuario/Documentos/git/proyectoA.git/
 
 shell$ git push http://localhost/git  # sale error
 fatal: http://localhost/git/info/refs not found: did you run git update-server-info on the server?
 
 shell$ git push git://localhost/git
 fatal: The remote end hung up unexpectedly
Alguien que me oriente !!... Saludos !
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Diabliyo 
								       
								
								 Desconectado 
								Mensajes: 1.441
								
								 
								shell# _
								
								
								
								
								
								     | 
 
Creo que ya lo voy logrando, pero algo falla :S, miren les relato desde el principio:1- Me conecto al Servidor Dedicado y hago: 2- En mi servidor Localshell# ssh -l miusuario miservidor.comshell$ su
 Password:
 
 shell# cd /home/git/
 shell# mkdir prueba
 shell# cd prueba/
 shell# git init
 shell# echo "estoy en servidor dedicado" > dedicado.txt
 shell# git add .
 shell# git commit -am "Srv Dedicado"
 shell# exit
 shell# exit
3- Ahora la sincronicazion de Reposshell$ suPassword:
 
 shell# cd /home/git/
 shell# mkdir prueba
 shell# cd prueba/
 shell# git init
4- Creacion del Documento en Localshell# git pull diabliyo@git.miservidor.com:/home/git/datadiabliyo@git.miservidor.com's password:
 From git.miservidor.com:/home/git/data
 * branch            HEAD       -> FETCH_HEAD
 Already up-to-date.
# en Servidor Local, ya esta el archivo "dedicado.txt"
 shell# echo "estoy en el local" > local.txt
 shell# git add .
 shell# git commit -am "Srv Local"
 
 # subiendo novedades
 shell# git push diabliyo@git.miservidor.com:/home/git/data
 diabliyo@git.crver.net's password:
 Counting objects: 6, done.
 Delta compression using up to 2 threads.
 Compressing objects: 100% (3/3), done.
 Writing objects: 100% (5/5), 479 bytes, done.
 Total 5 (delta 0), reused 0 (delta 0)
 remote: error: refusing to update checked out branch: refs/heads/master
 remote: error: By default, updating the current branch in a non-bare repository
 remote: error: is denied, because it will make the index and work tree inconsistent
 remote: error: with what you pushed, and will require 'git reset --hard' to match
 remote: error: the work tree to HEAD.
 remote: error:
 remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
 remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
 remote: error: its current branch; however, this is not recommended unless you
 remote: error: arranged to update its work tree to match what you pushed in some
 remote: error: other way.
 remote: error:
 remote: error: To squelch this message and still keep the default behaviour, set
 remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
 To diabliyo@git.miservidor.com:/home/git/data
 ! [remote rejected] master -> master (branch is currently checked out)
 error: failed to push some refs to 'diabliyo@git.miservidor.com:/home/git/data'
Y finalmente, en mi Servidor Local, tengo el archivo dedicado.txt , pero en el Servidor Dedicado las cosas estan intactas, vaya, no esta subido el archivo local.txt . Alguna idea ?
 
 |  
						| 
								|  |  
								| « Última modificación: 11 Enero 2011, 04:06 am por Diabliyo » |  En línea | 
 
 |  |  |  |  |  | 
			| 
					
						| Diabliyo 
								       
								
								 Desconectado 
								Mensajes: 1.441
								
								 
								shell# _
								
								
								
								
								
								     | 
 
Ya vi el tuto y sigo sin conseguirlo, ademas ese tuto no menciona nada interesante mas que laparte de hacer este config:git config branch.master.remote origin && git config branch.master.merge refs/heads/master Pero el config que no le veo razon es este: git config branch.master.remote origin , ya que estaria casando el branch.master.remote con el "origin", y en lo particular, no pienso trabajar con un solo repo, tengo varios proyectos ya finalizados y que hago updates esporadicamente, asi que yo declararia  un git add remote NOMBREPROYECTO http://git.miservidor.com:/home/git/NOMBREPROYECTO . Bueno, el problema continua, y por cierto, si en el Servidor Dedicado  hago: git --bare init , no me crea el directorio .git/ , me pone todo en el directorio raiz (donde teclee el comando), y despues cuando en el Servidor Local  hago: git push diabliyo@git.miservidor.com:/home/git/PROYECTO , me dice: fatal: Couldn't find remote ref HEADfatal: The remote end hung up unexpectedly
 
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Diabliyo 
								       
								
								 Desconectado 
								Mensajes: 1.441
								
								 
								shell# _
								
								
								
								
								
								     | 
 
Ya pude subir mis actualizaciones   , pero.... no se va al branch master . Quizas el problema es que el branch master  no tiene permisos para que los remotos lo actualicen... Pero mi solucion de momento fue entrar al servidor dedicado, crear un branch X y dejarlo existente para que cuando un Remoto suba actualizaciones, utilice ese branch, el unico [/b]problema[/b] con esta modalidad, es que el master nunca se actualiza , es necesario entrar al Servidor Dedicado (por SSH) y actaulizarlo (git merge X ). El proceso fue:Servidor Dedicado En el Servidor Local (mi equipo)shell# cd /home/git/shell# mkdir proyecto  // creamos proyecto
 shell# git init  //inicializamos SIN utilizar "--bare"
 shell# git branch  // vemos los branch, solo tenemos a master
 * master
 
 // creamos el branch "dev" que usare para actualizar
 shell# git branch dev
 shell# git branch
 * master
 dev
shell# /home/miusuario/codigos/shell# mkdir proyecto
 shell# cd proyecto
 shell# git init
 shell# echo "prueba de texto" > hola.txt
 shell# git add .
 shell# git commit -am "estoy en Srv Local"
 
 // subiendo al repositorio Servidor Dedicado
 shell# git push diabliyo@git.miservidor.com:/home/git/proyecto dev
Ahora ya tenemos todo UP en el Servidor Dedicado, el problema es que solo se refleja  cuando entras al branch dev , y para que master lo refleje, es necesario entrar y emerger. // estoy en servidor Dedicadoshell# cd /home/git/proyecto
 shell# git branch
 * master
 dev
 
 // estoy hara que el branch "dev" actualize al branch "master"
 shell# git merge dev
Y listo....Agradeceria  quien me dijera como hacerle para poder subir las cosas directo al branch master , porque si lo intento, me dice este error: Counting objects: 6, done.Delta compression using up to 2 threads.
 Compressing objects: 100% (3/3), done.
 Writing objects: 100% (5/5), 479 bytes, done.
 Total 5 (delta 0), reused 0 (delta 0)
 remote: error: refusing to update checked out branch: refs/heads/master
 remote: error: By default, updating the current branch in a non-bare repository
 remote: error: is denied, because it will make the index and work tree inconsistent
 remote: error: with what you pushed, and will require 'git reset --hard' to match
 remote: error: the work tree to HEAD.
 remote: error:
 remote: error: You can set 'receive.denyCurrentBranch' configuration variable to
 remote: error: 'ignore' or 'warn' in the remote repository to allow pushing into
 remote: error: its current branch; however, this is not recommended unless you
 remote: error: arranged to update its work tree to match what you pushed in some
 remote: error: other way.
 remote: error:
 remote: error: To squelch this message and still keep the default behaviour, set
 remote: error: 'receive.denyCurrentBranch' configuration variable to 'refuse'.
 To diabliyo@git.miservidor.com:/home/git/data
 ! [remote rejected] master -> master (branch is currently checked out)
 error: failed to push some refs to 'diabliyo@git.miservidor.com:/home/git/data'
 |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  | 
			| 
					
						| Foxy Rider 
								       
								
								 Desconectado 
								Mensajes: 2.407
								
								 
								Deprecated
								
								
								
								
								
								     | 
 
Ahí te comenta que salvo que inicializes con --bare (por eso el link), no podés hacer un push master->master sin que pueda quedar inconsistente el tree, por eso el hacer un push a otro branch ...  Pero si insistís en hacerlo master->master simplemente logueate en el server remoto, andá a la carpeta donde está el repo y hacé un git config receive.denyCurrentBranch ignore
 pero por cada push, en el servidor va a corresponder un ( o poné un hook post-receive para no hacerlo a mano) git reset --hard
 digamos que, en limpio (para no perderse) ,toda la secuencia completa en el servidor quedaría así : mkdir test.gitcd test.gitgit initecho "Contenido de Prueba" >  a.txtgit add a.txtgit commit -sm "Initial Commit"touch .git/git-daemon-export-ok # para permitir que el repo se exportegit config receive.denyCurrentBranch warn # o ignore si no te interesa ver warningstouch .git/hooks/post-receivechmod +rx .git/hooks/post-receivenano .git/hooks/post-receive 
 y ahí poné  #!/bin/shcd ..env -i git reset --hard 
 y listo ... you're done =P ahora podés hacer push master->master sin ese error ... Saludos. |  
						| 
								|  |  
								| « Última modificación: 15 Enero 2011, 00:01 am por vertex@Symphony » |  En línea | 
 
 |  |  |  | 
			| 
					
						| Diabliyo 
								       
								
								 Desconectado 
								Mensajes: 1.441
								
								 
								shell# _
								
								
								
								
								
								     | 
 
Gracias [Alex]  tus recomendaciones han resuelto el problema... PEro como bien dijiste, si hacemos el repo usando el comando git --bare init , no necesitariamos hacer las correcciones que me mencionaste... Ahorita tengo un inconveniente, espero puedan ayudarem !... Tengo un repo ya funcionando y todo, pero debido a que no tengo ya tiempo de estar tipeando en consola hacerle push  de mis actualizaciones, me estoy intentando hacer un script para que lo ejecute cron cada ma~ana antes de llegar al trabajo, pero me topo con el problema que no logro  meter el password   .... Este es mi script: cd /home/user/mi_proyecto/git push miusuario@localhost:/mnt/respaldos/git/mi_proyecto master
Pero como han de saber, si ejecuto el segundo comando (de los que puse arriba), me pide password  para autentificar y después hacer push... Y obviamente, si CRON ejecuta el script no puede meter el password, por lo cual, JAMAS se actualiza el repo... Alguna idea ? Saludos ! |  
						| 
								|  |  
								|  |  En línea | 
 
 |  |  |  |  |  
 
	
 
 
				
					
						| Mensajes similares |  
						|  | Asunto | Iniciado por | Respuestas | Vistas | Último mensaje |  
						|   |   | [Duda] Hola soy New en linux y tengo unas cuantas dudas GNU/Linux
 | eDDy-X | 4 | 3,614 |  5 Enero 2016, 17:17 pm por Alejandro1996
 |  
						|   |   | tengo problemas con los repositos de linux mint me sale una x no actualiza GNU/Linux
 | lealesdibua | 0 | 2,158 |  7 Agosto 2010, 10:41 am por lealesdibua
 |  
						|   |   | tengo problemas al instalar  linux 5.10 en mi lapto
							« 1 2 » GNU/Linux
 | manuelduran | 11 | 7,451 |  17 Junio 2011, 06:46 am por manuelduran
 |  
						|   |   | Tengo problemas con sqlmap en linux y windows GNU/Linux
 | joseph Lovato | 4 | 12,383 |  10 Abril 2012, 17:39 pm por terito
 |  
						|   |   | Tengo problemas habituales con las distros linux en usb GNU/Linux
 | NEXUS978 | 4 | 3,617 |  31 Agosto 2012, 02:16 am por Squirtle
 |    |