2016-04-14 6 views
0

Ich muss einen Git-Server auf meinem cPanel WHM VPS einrichten, generieren Sie eine URL zum Verbinden mit einem Repo (Ich habe ein Repo erstellt auf/opt/git/repo.git und konfigurieren SourceTree oder jedem anderen Windows-visuellen Git-ClientGIT: Wie git Repository auf WHM Centos Server erstellen und mit SourceTree verbinden

ich diese Anleitung gefolgt:.. https://newagesoldier.com/setting-git-cpanel-server/ und mein Setup Repo

Dann habe ich versucht, es zu klonen, indem sie diesen Befehl ausführen auf meiner Windows-Konsole :

git clone [email protected]/opt/git/repository.git 

b ut habe diesen Fehler:

fatal: repository '[URL]' does not exist

Ich habe gelesen Tonnen Beiträge und Fragen zu diesem Fall, aber viele sind wirklich alt und andere sind entweder nicht klar oder unvollständig.

Danke!

Antwort

1

Wie git push/pull mit ssh zwischen Windows und cpanel Linux-Konto.

* Server: Linux: CentOS/WHM/cPanel/ssh Konto

Dev: Windows7 x64: mit C:/Cygwin (2016), Kitt (2015),

[Windows] 
> puttygen 
    generate and save to ~/.ssh/myprivatekey.ppk 
    > save as openssh > myopenssh.key 
    > Copy public key mypublickey.txt 

[Cpanel] 
    Allow ssh access 
    Paste mypublickey.txt into cpanel ssh keys, 
    Authorize key. 

[Check SSH key works] 
> ssh -V 
    ..2016.. 
> c:/cygwin/bin/rsync --list-only \ 
    -e "ssh -i myopenssh.key" \ 
    "[email protected]:/home/USERNAME" 
    SUCCESS 

[Linux] 
> putty [email protected] 
    using above myprivatekey.ppk 
$ pwd 
    /home/USERNAME 
$ hostname 
    website.org 
# Setup git repo on linux 
$ git --version # 1.7... yum update...on linux if you need a new git.  
$ alias git="/usr/local/cpanel/3rdparty/bin/git"  
$ git --version # 2.8...   
$ mkdir ~/repo.git ; cd ~/repo.git ; git init --bare  
    Initialized empty Git repository in /home/USERNAME/repo.git/ 
$ git config --global user.name "USERNAME" 
$ git config --global user.email [email protected] 
$ cd ~ ; git init; git remote add repo repo.git  
$ git add public_html 
$ git commit -m "first commit" 
$ git push repo master 
    SUCCESS 

[Windows] 
:: **Now clone CPANEL account into xampp** 
> cd c:/xampp/htdocs/WEBSITE 
> git --version # 2.8... 
> git init 
> git remote add origin ssh://[email protected]/home/USERNAME/repo.git 
> git pull 
    Permission denied (publickey,gssapi-keyex,gssapi-with-mic). 
> git config core.sshCommand "ssh -i path/to/openssh.key" 
:: Dont use doublequotes in the next command 
> set GIT_SSH_COMMAND=ssh -i path/to/myopenssh.key 
> git pull 
    SUCCESS 
:: .. edit .. commit 
> git push 
    SUCCESS 

Optional Setup für Windows/cmd/cygwin

> set HOME=c:/users/%USERNAME% 
> setx HOME %HOME% -m 
> cd /d %HOME% 
> mkdir .ssh 
:: OR create a hardlink to your .ssh dir 
> mklink /D c:/your/.ssh .ssh 
> ls -al ~/.ssh/ 

wenn Fenster cygwin64/ssh über schlechte Berechtigungen für ~/.ssh/config beschwert, verwenden dieses Flag -F ..

> set GIT_SSH_COMMAND=ssh -F ~/.ssh/config -i path/to/myopenssh.key 
> setx GIT_SSH_COMMAND "ssh -F ~/.ssh/config -i path/to/myopenssh.key" -m 
> ssh -F ~/.ssh/config -i path/to/myopenssh.key 
Verwandte Themen