Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Projekt GIT w zdalnym repo
Matrix12
post 19.08.2015, 14:10:59
Post #1





Grupa: Zarejestrowani
Postów: 144
Pomógł: 0
Dołączył: 22.03.2015

Ostrzeżenie: (0%)
-----


Witam,


posiadam projekt w katalogu /var/www, chciałbym aby użytkownik mógł pobrać to repo i to nie jest żadnen problem po SSH może ścignać. Jednak chciałbym aby użytkownik mógl pobierać dane tak git clone ssh://name@ip/home/repository/project.git

Czyli po wklejeniu tej ścieżki będzie mógł zrobić pull i ściagnac projekt na localhost czy gdzieś tam.. ale zrobi git push to aby zmiany były wczytane w projekt trzeba wejsc w /var/www/ i tam zrobić git pull..




Problem mam z wykonaniem tego.. czy ja muszę zrobić skrót do .git czy jak do tego podejść?
Go to the top of the page
+Quote Post
Pyton_000
post 19.08.2015, 14:37:55
Post #2





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


flow jest taki że:
- Tworzysz repozytorium --bare czyli bez plikowe - i to jest twoje bazowe repozytorium do którego pchasz i pobierasz
- tworzysz sobie clone w /www
- ustawiasz w --bare hook_after_push żeby wszedł ci do www i zrobił automatem pull

Go to the top of the page
+Quote Post
Matrix12
post 19.08.2015, 20:23:58
Post #3





Grupa: Zarejestrowani
Postów: 144
Pomógł: 0
Dołączył: 22.03.2015

Ostrzeżenie: (0%)
-----


Znaczy ja nie chce automatycznie pulla. Chce aby gitrepo było w home a projet w innym katalogu a potem ja sobie recznie zrobi git pull(muszę tak kontrolowć zmiany)
Go to the top of the page
+Quote Post
Pyton_000
post 19.08.2015, 20:51:22
Post #4





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


Tworzysz sobie usera 'git' z katalogiem domowym

Potem wchodzisz do tego katalogu i dajesz `git init --bare`

teraz możesz dać `git clone git@domain.pl:repoo.git`

i tyle.

możesz w katalogu home dać sobie jakiś podkatalog na repo np. /home/git/repos/
i wtedy
`git clone git@domain.pl:repos/repoo.git`
Go to the top of the page
+Quote Post
kchteam
post 20.08.2015, 06:34:41
Post #5





Grupa: Zarejestrowani
Postów: 4
Pomógł: 2
Dołączył: 23.06.2015

Ostrzeżenie: (0%)
-----


Repo zdalne dostępne dla użytkowników po ssh i dla Ciebie na maszynie ustawiasz w home/repository (polecenie odpalasz w katalogu, który ma zawierać repozytorium) za pomocą:
git init --bare - teraz jest puste [1]

W katalogu www z kodem robisz:
git init - aktywujesz wersjonowanie dla plików
git remote add production_upstream /path/to/bare - podłączasz się do repo bare

git add . - dodajesz wszystko do wersjonowania (jak czegoś nie chcesz wersjonować, to dodajesz do pliku .gitigonre)
git commit -m 'Wersja startowa'
git push --set-upstream production_upstream master - wysyłasz stan startowy aplikacji do repo dostępnego zdalnie.

Teraz użytkownicy robią clona, modyfikują kod, wysyłają zmiany na repo [1],
a Ty z produkcji pullujesz, co uważasz za stosowne z [1].

[Adam]
Go to the top of the page
+Quote Post
Matrix12
post 20.08.2015, 19:48:20
Post #6





Grupa: Zarejestrowani
Postów: 144
Pomógł: 0
Dołączył: 22.03.2015

Ostrzeżenie: (0%)
-----


Właśnie mam z tym problem. Utworzyłem użytkownika który może ściągać repo ale pushować już nie może. Wiecie z czego to wynika ? Jak to obejść? Serwer jest postawiony na linuxie.
Go to the top of the page
+Quote Post
Pyton_000
post 21.08.2015, 07:41:34
Post #7





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

Ostrzeżenie: (0%)
-----


a pull z jakiego adresu robisz?
push jaki błąd wywala?
Go to the top of the page
+Quote Post
Matrix12
post 14.09.2015, 20:19:46
Post #8





Grupa: Zarejestrowani
Postów: 144
Pomógł: 0
Dołączył: 22.03.2015

Ostrzeżenie: (0%)
-----


Total 3 (delta 1), 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'.

! [remote rejected] master -> master (branch is currently checked out)
error: failed to push some refs to 'ssh//ip do serwa

Ten post edytował Matrix12 14.09.2015, 20:20:33
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 16.04.2024 - 20:44