Cómo crear un repositorio Git en servidor local Linux con permisos de grupo

Crear usuarios linux o en mi caso usar unos existentes, y añadirlos al grupo «git». En mi caso el usuario es «egarcia» y todos los comandos los ejecutamos como root.

1
#usermod -a -G git egarcia
Crear el directorio para el repositorio:
1
2
/var/git# mkdir repofolder.git
/var/git# cd repofolder.git
Y **dentro** del directorio ejecutar los siguientes comandos:
1
2
3
4
/var/git/repofolder.git# git init --bare --shared=group .
/var/git/repofolder.git# chmod -R g+ws *
/var/git/repofolder.git# chgrp -R git *
/var/git/repofolder.git# git config core.sharedRepository true
Con esto ya podemos clonar el repositorio en la máquina local donde queremos empezar a desarrollar y empezar a subir los cambios.

Cuando usaba Debian para desarrollo realizaba los commits por consola, pero buscando un buen GUI para Windows, encontré Sourcetree. Para clonar un repositorio en él es tan fácil como darle a Clone, introducir en Source path: «x.x.x.x:/var/git/repofolder.git», donde x.x.x.x es la IP y seleccionar el directorio de destino en la máquina local.

Dejo el Gist con la explicación:

Form validation // Validación de formularios – Javascript

Add this to your html’s HEAD tag:

1
<script type="text/javascript" src="valida.js" ></script>

And this to your html’s BODY tag:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<form name="myForm">
    <table>
    <tr>
          <td>Nombre</td>
          <td><input type="text" id="name" name="name"/></td></tr>
    <tr>
          <td>Apellidos</td>
          <td><input type="text" id="surname" name="surname" /></td></tr>
    <tr>
          <td>Teléfono móvil</td>
          <td><input type="text" id="phonenumber" name="phonenumber" /></td></tr>
    <tr>
          <td>¿Desea suscribirse al boletin?</td>
    <tr>
          <td><input type="radio" name="subscribe" value="y" />Sí, quiero suscribirme
          <input type="radio" name="subscribe" value="n" />No quiero suscribirme</td></tr>
    <tr>
          <td>Seleccione los temas que le interesen</td>
          <td><input type="checkbox" name="topics" value="artculture" />Arte y cultura
              <input type="checkbox" name="topics" value="cience" />Ciencia
              <input type="checkbox" name="topics" value="music" />Música</td></tr>
    <tr>
          <td align="right"></td>
          <td><input type="button" value="send" onclick="validar()"></td>
    </tr>
    </table>
</form>

This is «valida.js» content. Just create a file with that name and copy this code to it.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function validar()
{

    if( document.myForm.name.value == "" ) // This field can't be empty
    {
        alert( "Tiene que escribir su nombre" );
        document.myForm.name.focus();
        return false;
    }

    if( document.myForm.surname.value == "" ) // This field can't be empty
    {
        alert( "Tiene que escribir su apellido" );
        document.myForm.surname.focus() ;
        return false;
    }

    if( document.myForm.phonenumber.value == "" || // This field can't be empty
    isNaN( document.myForm.phonenumber.value ) || // Phone needs to be digits
    document.myForm.phonenumber.value.length &lt; 9) // Maximum phone length is 9 digits
    {
        alert( "Introduce un número de teléfono válido." );
        document.myForm.phonenumber.focus() ;
        return false;
    }

    if( document.myForm.phonenumber.value.charAt(0) != 6) // Phone must start with number 6
    {
        alert( "El teléfono debe comenzar por 6" );
        document.myForm.phonenumber.focus() ;
        return false;
    }

    alert( "Gracias por enviar el formulario" );

    return( true );
}

Hay bastantes ejemplos en la web sobre validación de formularios. Lo interesante de este ejemplo es que valida el número de móvil según las características de España. Para añadir otra condición es cuestión de modificar el «IF» correspondiente al teléfono.

  • Adsense