Git en GNU/Linux tengo problemas y dudas :(

(1/2) > >>

Diabliyo:
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:

Código:

shell# cd /home/git/
shell# mkdir proyecto1.git
shell# cd proyecto1.git/
shell# git init
shell# echo "prueba" > dato.txt
shell# git add .

OJO: 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:

Código:

# 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 !

Diabliyo:
Creo que ya lo voy logrando, pero algo falla :S, miren les relato desde el principio:

1- Me conecto al Servidor Dedicado y hago:
Código:

shell# ssh -l miusuario miservidor.com
shell$ 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

2- En mi servidor Local
Código:

shell$ su
Password:

shell# cd /home/git/
shell# mkdir prueba
shell# cd prueba/
shell# git init

3- Ahora la sincronicazion de Repos
Código:

shell# git pull diabliyo@git.miservidor.com:/home/git/data
diabliyo@git.miservidor.com's password:
From git.miservidor.com:/home/git/data
 * branch            HEAD       -> FETCH_HEAD
Already up-to-date.

4- Creacion del Documento en Local
Código:

# 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 ?

Foxy Rider:
Me parece que te salteaste algo ;)
Mirate este tutorial y el mensaje de error .. seguro que te salta la ficha de qué es : http://tumblr.intranation.com/post/766290565/how-set-up-your-own-private-git-server-linux

Saludos.

Diabliyo:
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:

Código:

fatal: Couldn't find remote ref HEAD
fatal: The remote end hung up unexpectedly

Diabliyo:
Ya pude subir mis actualizaciones :D, 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
Código:

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

En el Servidor Local (mi equipo)
Código:

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.

Código:

// estoy en servidor Dedicado
shell# 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:

Código:

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'

Navegación

[0] Índice de Mensajes

[#] Página Siguiente