git push heroku master: error - php

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.

Related

deploy Github public project (PHP) on dedicated server

my project is developed on github and now I want to deploy it to dedicated server, any help will be appreciated.
1) Login to your dedicated server using SSH.
for windows use putty
for ubuntu and mac use terminal
2) install git on your dedicated server . how to install ?
3) after that follow below commads :
Clone the repository : git clone https://github.com/username/repositoryname.git
Go into repository : cd repositoryname
after that if you add some new code in your code editor , use below command in your local git repository :
git add . // this will add your code to local git repo
git commit -m "code updated" // this will commit your changes in local git repo
git push // this will push your code from local git repo to github repo
after that go to ssh , go to your repository on your server and pull the latest code using :
git pull //it will pull your code to your server .

502 proxy error while pulling the code from git repo

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

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..

Create a new localhost Git repository from already cloned Git?

I would like to clone a Laravel 4 from Git HERE and after using a Composer to install all dependencies, I wish to create a new Git on my HDD where I have my Dropbox synchronized.
Is it even possible ?
After getting Laravel 4 being cloned into C:/www/laravel-project/, I would like to commit the whole project into my localhost REPO seating in D:/Dropbox/REPOS/Git/ so it will become D:/Dropbox/REPOS/Git/laravel-project/
Thanks
Two possible fixes:
Edit .git/config so that your origin is your repo (replace https://github.com/laravel/laravel.git with file:///D:/Dropbox/REPOS/Git/laravel-project/).
Delete the .git directory and then run git init and git remote add file:///D:/Dropbox/REPOS/Git/laravel-project/ origin
The problem I've seen with local directory repos is that the D:/Dropbox/REPOS/Git/laravel-project/ repo will need to be on a branch that will not be used (i.e. A DoNotUse branch).
There are two paths you can take to do this:
Change the origin to your "remote" and remove or rename the Laravel origin.
Preserve the Laravel origin and use a second "remote" for your files.
Option 1 is probably the easiest.
Go to D:/Dropbox/REPOS/Git/laravel-project/ and do git init to make an empty git repo.
Go to your C:/www/laraval-project/ folder and do git remote -v and save the URL for the current origin if you want to keep it.
Run the command git remote origin set-url file:///D:/Dropbox/REPOS/Git/laravel-project
Optional: run git remote add github url-you-saved-from-step-2 so you can do git pull github if you want to update from the Laravel github
Run git push -u origin master and it should push into your Dropbox's git repo.
For Option 2 you just skip steps 2 through 4 and - run git remote add dropbox file:///whatever and change step 5 to git push -u dropbox master or whatever branch you want. Once you use -u once you can just do git push and it should push to whatever you set as your upstream with -u.

Running git pull from a php script

I was trying the Perfect Workflow, with Git, GitHub, and SSH, and i have everything set up, except running the command git pull from php.
When i run exec('git pull') i get:
Could not create directory '/.ssh'. Host key verification failed.
fatal: The remote end hung up unexpectedly
If i run it in the terminal (as root) it works just fine, but i need this hook to work from the Post-Receive URL (Github).
If i do exec('whoami') i get apache.
It's a (dv) from mediatemple with CentOS.
If you want apache (the user) to be able to pull from git, you'll have to create an ssh key for apache, then add that to the read only keys on github.
The flow is something like this (tweak to your needs)
usermod -s /bin/bash apache
su apache
cd ~
ssh-keygen # work through the keygen dance (added a dash)
Upload (tilde here refers to apache's homedir) ~/.ssh/id_rsa.pub to github and give apache access to whichever repos it needs to pull from.
Then you can test on the server by again su'ing to apache and running the git pull
su apache
cd ~/working-copy
git clone my-project
Once that's working you should be able to run a git pull through PHP.

Categories