git: 'pull' is not a git command - CentOS VPS server - linux

I recently set up a new VPS and have installed Git via yum and wget etc. All seemed well - I can add, commit, set up a remote and push to github.
However, when I try to pull from github:
user#domain.com [~]# git pull github master
git: 'pull' is not a git command. See 'git --help'.
Did you mean this?
shell
No, I didn't mean shell, I meant pull!
Now I've googled the heck outta this - including reading several posts on Stackoverflow:
"git pull" broken
git: 'pull' is not a git command. See 'git --help'
Although most posts seem to be about Mac issues (I'm on a CentOS server), it seems to be an issue with the git exec path, which is
user#domain.com [~]# git --exec-path
/usr/local/libexec/git-core
I've tried adding a various things to .bashrc with no success.
The key thing is that when I cd down to /usr/local/ and ls -l, I can't see a libexec directory.
But if I log in as root, I can cd to /usr/local/ and see libexec/, inside which is git-core. I can also git pull as root.
So - I suspect the problem is more to do with permissions and the server setup than git itself.
I've tried
sudo chmod a+rx /usr/local/libexec
But that did nowt too...
When I ssh into another server, as an account user, I can cd down to /usr/local and see libexec - so there's something wrong with this server setup.
Any ideas gratefully received.

Solved it now - the server is using jailshell... Disabling jailshell and using 'normal' shell works a treat

Related

fatal unable to find remote helper for https

When trying to clone a repo with git on a Red Hat Enterprise Linux server:
git clone https://github.com/user/repo.git
I receive an error with output:
fatal: Unable to find remote helper for 'https'
I noticed the error when trying to install packages with Vundle for vim. When I looked at the log i found that it was git that was causing the error. The problem is not present when separately running:
sudo git clone https://github.com/user/repo.git
... and running:
/usr/bin/git clone https://github.com/user/repo.git
... also worked fine. Since I run git through vim in this case I want it to work with just the git command.
I have tried to uninstall all the yum-installed git-related packages. I have also tried the approach in this Stackoverflow answer without any results. I have tried to install the latest git from source with this tutorial.
After 2/3 of a work day trying to figure out what was wrong i manually removed every git-related file and directory i could find. Then i simply reinstalled git with
sudo yum install git
Now is everything working fine.
So try doing
find /usr/ -name 'git*' -type d
to find the git-related directories, then remove all these directories. After this you do a new search and pipe that into less to handle the possible large output,
find /usr/ -name 'git*' | less
take note of the exec files and remove them. Mine where in /usr/local/bin. After this you reinstall git with yum like above.

Unable to access Gitlab repositories since moving git-data folder

I ran out of space on the partition the git-data folder was stored on, so I followed the steps in this link change the data directory gitlab to store repos elsewhere
However this didn't work, so I've moved the git-data folder back to /var/opt/gitlab/git-data and restored the gitlab.rb file configuration back to how it was before, and after reconfiguring gitlab and restarting it's still not working.
When I try to access a repository via the web interface, Gitlab simple tells me that the repository is empty.
I've also tried changing the permissions on the git-data folder to have git as the owner and group, and changing the permissions to 755.
Is someone able to advice a possible fix for this?
I've freed up space on the partition now so that is no longer an issue.
EDIT: After some reading I've set the following permissions, which hasn't resolved the issue;
# Holds repositories directory
sudo chown -R -v git:root /var/opt/gitlab/git-data
sudo chmod -R -v 0700 /var/opt/gitlab/git-data
# Holds git repositories
sudo chown -R -v git:git /var/opt/gitlab/git-data/repositories
sudo chmod -R -v 2770 /var/opt/gitlab/git-data/repositories
EDIT: I've logged into Gitlab and created a new repository, which has created fine and appears in the git-data/repositories folder, so I suspect that the permissions on the git-data folder are correct. However for some reason gitlab still thinks that the existing repositories are empty.
Thankfully I managed to resolve this.
Luckily Gitlab required an update so I ran 'yum update' and let all the necessary packages update. Once complete, I ran 'gitlab-ctl reconfigure' and finally 'gitlab-ctl restart' and everything now seems to be working again.
This would have probably fixed the problem:
gitlab-rake cache:clear RAILS_ENV=production

Git Archive of local Git repository

I have a Git repository on a server and on the same server I have a script which needs to do a git archive of the repository.
Here's my sample git archive command which works well for remote Git repositories:
sudo git archive --remote=ssh://uname#dev.example.com/var/repo/myrepo.git --format=tar --output=src.tar development
What would I need to do/change to execute the aforementioned command on the same server so that I don't need to put all the SSH stuff? Since the command is running on the same machine as the repository, can I get away with directly accessing the Git directory.
Thanks
Use
cd .../yourcode
sudo git archive --format=tar --output=src.tar development
(it is probably unnecessary to sudo)
Sure. Just run git archive from the directory that contains the local repo, and don't specify --remote.
From the directory that is your git repository run:
git archive | bzip2 > full/relative/or/qualified/path/to/place/you/want/to/store/your/archive.tar.bz2

git error: cannot handle https

when I tried to use git clone https://xxx I got the following error
I don't handle protocol 'https'
Could anyone please help me?
full message:
dementrock#dementrock-A8Se:~$ git clone https://git.innostaa.com/innostaa.git
Cloning into innostaa...
fatal: Unable to find remote helper for 'https'
dementrock#dementrock-A8Se:~$ git --version
git version 1.7.4
Fixed this problem for Git 1.7.9 on Windows. Seemed to happen with many GIT instantiations on Windows. Had to do with the url not being properly escaped in the command line.
Solution: Put the git repository URL in single quotes 'https://.......'
Version 0.99.9i of git probably does not support https protocol.
Try to install a more recent version of git. The easiest solution would be to install it via apt-get:
$ apt-get update
$ apt-get install git
After that check that the correct version is used:
$ hash -r
$ which git
/usr/bin/git
If the returned string is not /usr/bin/git, then you have another older version of git in your PATH that is masking the more recent one. Remove it.
If you do not want to install git via apt-get or if you do not have administrator privilege on your machine, you can built it from source. You can download them from git website, and compilation should be as simple as:
$ tar -xvfj git-1.7.4.2.tar.bz2
$ cd git-1.7.4.2
$ ./configure --prefix=$HOME/install
$ make && make install
After that, you'll have to add $HOME/install/bin to your PATH.
$ hash -r
$ PATH="$HOME/install/bin:${PATH}"
$ git --version
git version 1.7.4.2
I have same problem but the reason was in my configuration of my .git. I changed config file as follows:
.git/config
enter code here[remote "heroku"]
url = git#heroku.com:rocky-bayou-4315.git
fetch = +refs/heads/*:refs/remotes/heroku/*
rocky-bayou-4315 is my heroku application that has been created by $ heroku create command.
I had the same problem while trying to "fetch upstream". I solved it by getting the Git-read only address instead of the https.
details:
I had a forked repository that needed updated from its original repo. Using github's help I added a remote upstream and tried to fetch it.
I then went to Git-hub and where I usually get the address of the the repo I clicked on the "Git-read only" button and got a new URL. I removed my past upstream and added another one with the new URL, which worked perfectly.
Just encountered this problem with git 1.7.9 on cygwin.
Using the double quotes "" to wrap the https URL can solve my problem.
eg:
git clone "https://github.com/joyent/node.git"

subversion error : Can't open file '/var/svn/mobilesync/db/txn-current-lock': Permission denied

We have a repository running on subversion 1.6.6 on Ubuntu server. While adding a new file to the working copy and committing it to the repo, we get the error
Can't open file '/var/svn/mobilesync/db/txn-current-lock': Permission denied
What is the issue and what can I do about it ? Is it a matter of a lock created by a previous process instance that didn't get removed because of some error ?
Thank you,
UPDATE
Here were the commands that I used to create the repo
1) sudo svnadmin create myrepo
2) sudo chown www-data:www-data myrepo
I fixed this problem by changing the second command
sudo chown -R www-data:subversion myrepo
and then I was able to commit my files.
I faced this problem when i imported another repository into my own svn server. And the following command solved my issue:
$sudo chown -R www-data:www-data myrepo
fyi, you need to log in your svn server, check the permission of existed repositories, in my case it's www-data etc. and use 'chown' to change the owner and group of your repository in terms of owner setting of your other repositories.
-R is used as recursive option.
"myrepo" means the name of your repository.
i think "www-data" is used for apache server which is used inside my svn server.
Hope it helps.

Resources