pull command error : Failed connect to github.com:8080 - git-pull

I tried to pull repository so that I can merge the changes made to my repository.
But while using the pull command it gives following error:
$ git pull https://github.com/ShrutiRuparel/depot.git master
error: Failed connect to github.com:8080;
No error while accessing https://github.com/ShrutiRuparel/depot.git/info/refs
fatal: HTTP request failed
I tried setting the http proxy but no change.
push command worked perfectly fine but error with pull command.
Any suggestions?

I had the same issue because I forgot to remove my proxy configuration on Git.
git config --global http.proxy
If it returns something you have to unset the value with the following command :
git config --global --unset http.proxy
There is a lot of way to set a proxy for git and maybe this is not the good one. You can also check your environment variable.
echo $http_proxy
After that, it should works

Why are you using https?
For private repo on GitHub, you would use (as shown here):
git clone https://username#github.com/username/project.git
But for a public repo, a simple:
git clone http://github.com/username/project.git
should be enough.

Related

Problem committing a project from RStudio to Github

I'm trying to push my files to my GitHub, but I'm getting the following error:
error: cannot run rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': Device not configured
Details:
I'm using MAC
My git version: git version 2.32.1 (Apple Git-133)
I'm linking my project to GitHub with HTTP protocole
I ran git config --global user.name and user.mail in the terminal in Rstudio
I tried to use the solution of running git push -u origin main and when I type in my credentials, it gives me the error: "authentication failed". I never changed my password to GitHub, I checked it today to enter the website, it works.
I tried using ssh protocol instead but it seems to be giving me even more errors even though I created my ssh key and added it successfully to my GitHub. Specifically when I click on create new project and add the ssh link Rstudio says:
Cloning into 'data-science-hw'...
ssh_askpass: exec(rpostback-askpass): No such file or directory Host key verification failed.
fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
I went through all the possible suggestions I could find on the internet but none of them worked. I also tried linking a token generated by git, but it work either.
I would be very happy if anybody has any idea what else I could try..

Creating a git repo for an existing R project - "fatal: Couldn't find remote ref master" error

I want to finally start using version control for my R projects. I started following this guide, created an empty repo, but the problem started when I got to the command line part.
First I did:
git remote add origin https://github.com/username/repo_name.git
But after I type:
git pull origin master
I get this error:
fatal: Couldn't find remote ref master
Now, if I try the following:
git remote -v
I get:
origin https://github.com/username/repo_name.git (fetch)
origin https://github.com/username/repo_name.git (push)
So something is working. I am new to git and not sure about where the problem is.
As an attempt to fix the problem, I added one file for the repository (file.R) but apart from that, the repository is empty. I get the same error as before.
And if I try git branch -r on the terminal I don't get anything in return.
If you started by creating an empty repo in GitHub, then the default branch is no longer master. The default branch is now main.
If you started by creating a new repo locally using git init, then check what your default branch is using git branch. This should show you either a main or master branch.
It may be easier to create the repo in GitHub with a simple README.md and .gitignore, then clone that repo to another folder. Move your code into that repo, add and commit everything, then push your code to GitHub.

Using http for a different github account

I'm trying to connect using http for a second github account I've recently set up. When I pushed to https://github.com/usernameOf2ndGithubAccount/repo.git, I always got the following error:
remote: Permission to usernameOf2ndGithubAccount/repo.git denied to usernameOf1stGithubAccount
That means I've probably made the username of my 1st github account as the default somewhere. But I've looked through all my environment variables and bashrc but couldn't find it to be set anywhere. Can someone please point out how to fix this issue? Thanks!
P.S. I've tried connecting using ssh for my 2nd github account (by using a new pair of private/public key), and that works fine.
You can specify the username to use in the URL, e.g.:
https://usernameOf2ndGithubAccount#github.com/usernameOf2ndGithubAccount/repo.git
When you set-up git, it will ask for a username and email. This will we global for all your repositories.
You could see your name and email with (which could be different for each repository)
git config user.name
git config user.email
You could change it as follows (only for the current git repository)
git config user.name "myname"
git config user.email "my#email.com"
To see your/update global config, pass --global (after config), e.g.
git config --global user.email
When using TortioseGit, you could easily view and change with a GUI.
This is windows credential manager problem. Nothing to do with SSH or HTTPS. You need to add the second account to the manager. It only reads the github site not the direct https path.
Bash terminal git config --global credential.useHttpPath true
this will add the direct path not just the github site.

Pushing files to a BitBucket repo doesn't work

I'm new to git and would like to get started using bitbucket.org as a place to create a private repository. This can then be uploaded to the staging server using a service like ftploy.com as I understand.
I am following a tutorial on WPBeginner.com to set up a staging environment for my WordPress local website which I am developing. I set up git on the mac, ran git init on the theme folder and then added all the files using git add .
After that I made a first commit using git commit -m "message here" So far the process appeared to work. No feedback in the terminal though? I then added the line
git remote add origin https://bitbucketusername#bitbucket.org/bitbucketusername/repositoryname.git
Replacing bitbucketusername with mine and repository name with mine. Attempting to push the files to the bitbucket repository resulted in this error however:
error: --all can't be combined with refspecs
usage: git push [<options>] [<repository> [<refspec>...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
--delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--force-with-lease[=<refname>:<expect>]
require old value of ref to be at this value
--recurse-submodules[=<check>]
control recursive pushing of submodules
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack>
receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
--prune prune locally removed refs
--no-verify bypass pre-push hook
--follow-tags push missing but relevant tags
If you have any thoughts on why this may be the case I would appreciate it
You should provide us the command you used to do your git push, but my guess is you did something like this:
git push --all origin master
As git is telling you, this can't be used that way. Here you are asking git to push everything to origin but then you specify a branch (the <refspec>), so it is confusing.
Either push all like this:
git push --all origin
or just your master branch like this:
git push origin master

Symfony2 Composer Install

I am trying to install Symfony 2.1.3 (latest). I am running composer and installs everything okay. The only error that I get is:
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
It's being installed under www folder. I am running nginx and followed the composer approach. I read on internet that apache should be run manually not as a service, however I am using nginx instead. Does apache still have any bearing on it? I'm using debian squeeze.
Edit: As per AdrienBrault's suggestion the error was because the timezone was not set in the php.ini. Only with --verbose I could see the warning. Thanks guys.
Apache is not related - PHP is called via command line.
Most likely is the permission in the cache folder: did you check if the user that runs the composer update can actually write the cache folder?
Try to manually run rm -Rf app/cache/dev (for production environment replace dev with prod) and see if you get any permission error.
Also you will get this error if the default.timezone setting is not configured in php when running in CLI. To verify just run
php --info | grep timezone
and check that the setting date.timezone is correctly configured.
On the security side, setting 777 to the folder is not the optimal solution - if you have ACL enabled you could use that to correctly set up the permission for the cache and logs folder. Read more at the Symfony2 official installation page
I had this same issue for a while and after hours of face to brick wall pounding I realized... I have a .gitmodule in my project, and on initial checkout these submodules are NOT initialized and as such are not there for your composer to update, which results in the above error.
Make sure you run the following
git submodule update --init src/Acme/Sadness/Bundle
of course replace src/Acme/Sadness/Bundle with YOUR project namespace.
Hope this helps someone not go through the same pain I just did.
If you have vendor folder already I would remove it and install symfony 2.1.3 again via "composer.phar install". Problem might be coming from outdated version of composer
I had the same problem and I resolve in this way.
execute this on the console
and you should see something like this
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini
/etc/php5/fpm/php.ini
the first line is probably your php.ini that appear when you do a phpinfo();
the problem is that when you execute composer update this no check the same php.ini
in my case the second line
all my sites work fine but always I had problems not now
after edit the second file and put the same time zone that you set in the first one
run
$ sudo service apache2 reload
and now
$ composer update
I hope that this work for you like work for me
regards
Emiliano

Resources