'fatal: remote part of refspec is not a valid name in ..' error when setting up Git [duplicate] - wordpress

This question already has answers here:
git push origin gives remote part of refspec is not a valid name
(7 answers)
Closed 8 years ago.
I'm trying to setup git with WPengine following the instructions here: (http://wpengine.com/git/#production) - but when I get down to the deploy step, I get the following error:
% git remote -v
production git#git.wpengine.com:production/workshop-wp.git (fetch)
production git#git.wpengine.com:production/workshop-wp.git (push)
% git push production master ...
fatal: remote part of refspec is not a valid name in ...

Don't put ... in the push command. The correct syntax is
git push production master
I know that the instructions in the tutorial that you linked to say to do this:
git push production master ...
but that's just blatantly incorrect.

I got it to work. I was trying to deploy my GitHub repo name:
$ git remote add production git#git.wpengine.com:production/my_wordpress_app.git
Instead of deploying my wpengine username
$ git remote add production git#git.wpengine.com:production/robertwilliams.git

Related

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.

Git - Can't Push - "! [remote rejected] master -> master (Working directory has unstaged changes)"

I am trying to set up a "simple" git workflow for a Wordpress installation that has a local version, a staging version and a production version. All I want to do is make changes locally and push from local to staging and from local to production. At first I thought this would be a simple task. I have been able to initialize the repository, add the two remotes "staging" and "production", initialize git on the remotes and push changes from my local version to the staging and production servers normally using the commands:
git add .
git commit -m "some changes"
git push staging master
git push production master
However, at some point during my work something changed, and while I am still able to push to Staging, now I am unable to push to the Production server without getting the error:
! [remote rejected] master -> master (Working directory has unstaged changes)
When I do "git status" it says:
On branch master
nothing to commit, working tree clean
After reading the answers to several SIMILAR BUT DIFFERENT questions on Stack Overflow I have tried the following:
git pull staging master
git pull staging master --rebase
git pull production master
git pull production master --rebase
I also tried executing this command on the remote servers
git config --local receive.denyCurrentBranch updateInstead
I have already completely re-created the servers and repositories a few times just to re-install git entirely from scratch, but this problem keeps happening after a while and at this point Git is actually HURTING my workflow instead of helping it. If anyone has any insight into what my mistake is, it would be much appreciated!
I had similar problems, pushing to a non-bare remote repo where I wanted the working copy files to be checked out immediately.
My remote was configured with receive.denyCurrentBranch updateInstead, but it still refused to accept pushes at unpredictable times.
Git 2.4 added a push-to-checkout hook, which can override such push failures.
I wrote a short script based on the example in the githooks documentation.
#!/bin/sh
set -ex
git read-tree --reset -u HEAD "$1"
I installed this script in .git/hooks/push-to-checkout in my remote repo.
Note that this script overwrites the working copy in the remote — it does not attempt to merge any changes to those files.
That's because I want the working copy to simply reflect the files in the repo.
Making a git bare repo is the best practice to push to.
You could push to a non-bare one... but only if you are not modifying files on the destination side while you are pushing file from the source side. See push-to-deploy.
But the best practice remains to add a post-receive hook (as in my other answer) in order to checkout in an actual folder all the files you have received.

r studio fatal: No configured push destination

I'm trying to create a blog using R package blogdown.
The last step is to push my files to Github, and I clicked "Push Branch",
which gave me this error message:
I'm not very experienced with Git/Github integration with R Studio. Can somebody leave a detailed explanation of what to do?
Syntax
You add remote git server URL to local git repository config like this
git remote add origin your_git_repository_url
Example
At git local repository folder, release command:
git remote add origin https://github.com/donhuvy/java9.git
Learn more
https://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes#_adding_remote_repositories (official reference document)
https://help.github.com/articles/adding-a-remote/

Git push failure (Github/RStudio)

I've used Git successfully on this machine in the past but suddenly I can no longer push my commits to the Github repo. The last change to the Git toolchain that I made was to install Git 1.8.5.2, in addition to the Github for Windows client. RStudio could not find Git unless I'd already started the Github client so I decided to simply install a stand-alone Git client and change the RStudio Git path.
Error message (RStudio):
error: cannot spawn rpostback-askpass: No such file or directory
fatal: could not read Username for 'https://github.com': No such file or directory
Troubleshooting:
I can commit all projects.
I can pull new projects.
I cannot push any projects, I receive the same error message every time.
I cannot push with Github or RStudio.
Reinstalling /uninstalling Git / Github does not resolve the issue.
Setup:
This is an R project, with RStudio as my IDE / Git GUI.
I'm using Git 1.8.5.2 for Windows 7.
Let me know if there's any more information that you need.
Update 1:
Git GUI tells me that:
Error: hook execution requires sh (not in PATH).
Let's see if I can fix that...
Found something that might help from here: https://github.com/STAT545-UBC/Discussion/issues/93
in RStudio, click on the "Tools" menu and select "Shell"
Run the following command: git push -u origin master
it might ask you for your git username and password. Supply this information, make sure it is correct
hopefully the push is successful, then you can close the window
Now make some more edits to some file so that you have new content to push
click on the "push" button in RStudio and this time the push should work
Found a different suggested solution here: https://github.com/OHI-Science/ohicore/issues/104
git config --global credential.helper osxkeychain

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

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.

Resources