502 proxy error while pulling the code from git repo - php

I am writing a php script where it clones first and then pulls from a bitbucket git repo.
It works well on my local machine, but on dev server there is proxy configured, so whenever i tried to run the script on server it gives "502 proxy error"
when i directly try to clone from command line on dev server it works.
some google links suggested to configure global proxy like
git config --global http.proxy proxyserver:port
I tried this as well, but not working through script.
Please help.

I ended up using following command before pulling repo in script.
git --config http.proxy=http://proxy_host:proxy_port

Related

'git clone' command work from terminal but not with php shell_exec()

I am getting following error when i git clone using php shell_exec() on windows server. My git version is git version 2.11.1.windows.1.
Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists
But working fine through git bash and command prompt. I have configure ssh properly.
The problem is the file which i have created is in the c:/inetpub/example.com/deploy.php
I am running following code in php file.
shell_exec('cd c:/inetpub/ && "c:/Program Files/Git/bin/git" clone sshURL 2>&1')
Can any one suggest any solution to fix this issue.

How to deal with GIT for an existing website?

I lost my notepad with details how to deal with a GIT.
On my webserver I have the following things:
- htdocs/git/project/.git
and the project is under:
- htdocs/project/
The local copy is under:
- Applications/MAMP/htdocs/project
How can I create a GIT to push all local changes to the project on the server?
On your local machine (presuming Git is installed) simply navigate to the folder in Git Bash and initialise a repo:
git init
Then set the remote to be the same as on your webserver. First find where this is by logging onto your webserver at the path where the .git folder lives and type:
git remote -v
This produces a git#yougithost.com:namespace/scheme.git type link. Capture that and then back on your local machine go to the folder again and type:
git remote add origin git#yougithost.com:namespace/scheme.git
Now both folders can talk to the same project (again this presumes that you have the ability to authenticate yourself against the remote repo).
From here you simply complete your vchanges locally, commit them and push to origin:
git commit -am "Updated files"
git push -u origin master
Then on your remote box simply...:
git pull origin master
Whammo, you'll have a copy.
Hope that helps get you started..

git push heroku master: error

I'm uploading a php project on Heroku and I'm following the instructions given on official website. When I reach the last command
git push heroku master
I receive the following error:
error: protocol https not supported or disabled in libcurl while accessing https://git.heroku.com/hidden-hamlet-3511.git/info/refs?service=git-receive-pack
fatal: HTTP request failed.
I've searched around and couldn't find any solution.
Heroku deploys are managed via git. Git has a concept called remote repositories; that is, repositories stored on another machine. When you git push, you're sending data to one of these remote repositories. git push heroku master means "push to the master branch on the remote repository named heroku."
You can use the git remote command to view the configured remotes for your repository. For instance, if you run git remote -v, you'll probably see something like this (you might have others listed too).
user#host dir$ git remote -v
heroku https://git.heroku.com/hidden-hamlet-3511.git (push)
heroku https://git.heroku.com/hidden-hamlet-3511.git (fetch)
Git can work with remotes via two protocols: http and ssh. Your remote is set up to use http (the default for Heroku), but your libcurl library doesn't have support for SSL, which is used for https. That's what your error message means - git can't use https to access its remote.
If you've set up SSH keys for your Heroku account you can remove the https remote, and reconfigure it as an ssh remote:
git remote rm heroku
git remote add heroku git#heroku.com:hidden-hamlet-3511.git
You can also use the heroku command to add an ssh remote for you, after removing the old one:
git remote rm heroku
heroku git:remote -a hidden-hamlet-3511 --ssh-git
The Heroku documentation has more information about using SSH with git remotes.

How to deploy basic php site on Openshift after pushing code?

I am trying to use Openshift for the first time to host a php site(PHP 5.4 cartridge) I am working on for a school project. I followed the directions here to push my existing repo to my gear, and can see that the code is on the gear by ssh-ing into the gear. What do I have to do now to host the website? I initially thought that I would just be able to see the index.php in my repo, but when I go to the provided url it is just a blank page. I think I may need to use the deploy action hook to cp the git repo somewhere, but not sure where. Any help would be appreciated.
With the PHP 5.4 cartridge the application root is the root of your application directory. Let me try and explain a bit further. If you create an application named "myphpapp" with the following command:
$> rhc app create myphpapp php-5.4
After the application is created, the git repository will be cloned to the directory you ran the create command. Change to that directory:
$> cd myphpapp
This is your application www root directory and is where you need to place files. For example, create a new test.php file like this:
$> echo "some php code" >> test.php
Add the file to your local git repository and then commit and push to your openshift server:
$> git add test.php
$> git commit -am "Adding a new file"
$> git push
When you run the git push command, the changes will be pushed to the remote git repository on the openshift server. Once the code is pushed, a hook on the server will see that a new file has been added to the repo and then deploy it to the www root on the openshift server. Once the deploy has finished, you can access the file by pointing to:
http://yourApp-yourDomain.rhcloud.com/test.php
Hope that helps.
--
gs
I did not read the documentation clearly enough. The root for the app is yourApp/php. So your repository has to have a php subdirectory inside of it, and that will be the app root. There is no need to copy your code from the repository to the root. As you have the correct structure, when you push your code the website will be live.

error: git was not found - installing laravel with composer windows

I'm getting an error saying:
failed to clone https://github.com/php-fig/log.git, git was not found, check that it is installed and in your PATH env.
'git' is not recognized as and internal or external command, operable program or batch file
when I try and run composer create-project laravel/laravel learning-laravel.
I installed the git GUI which also comes with a command line shell, but I don't know why its not recognising the command (I'm issuing the create-project command in the normal windows command line prompt).
I also tried running the command from the git shell, which worked, but when I tried php artisan serve it gave me an error saying CLI has stopped working.
Does anyone know how to fix the git error? I'd rather use the windows command shell instead of the git one as it can then go into my wamp/www file
You need to add the directory you installed git to to your PATH environment variable.
Right click on Computer.
Click Advanced System Settings
Click Environment Variables inside the Advanced Menu
Under System Variables, scroll to PATH
Add ;"C:\path\to\git\bin";"C:\path\to\git\cmd"
Test the git command in the command prompt to see if it worked. Git is usually located in Program Files or Program Files(x86).
There is an easier (but temporal) way to add a path variable in Windows.
Paste this in your command prompt:
SET PATH=%PATH%;C:\Program Files\Git\bin
This will work for the rest of the command prompt session. Don't forget installing Git before this.
You'll need to add git to your system PATH if you want to use it in regular command prompt.
Here's a guide on modifying your system path in Windows:
http://www.computerhope.com/issues/ch000549.htm
you need to uninstall git and reinstall ( or update ) in the options you need to change from git bash only to allow git to be added to command line as well, also since it then adds it to your path you may or may not need to restart your computer
I was having some issues using git on Windows. I found this information only and it worked for me.
http://ccn.ucla.edu/wiki/index.php/Setting_Up_and_Using_Git#Windows

Categories