Git did not exit cleanly (exit code 1) - gitlab

I can't push and I already tried all solution in this question. I'm using Windows10 and TortoiseGit.
I generated my SSH key with PuTTYgen and I already tried to replace the key in case my older was corrupted. When I try with git bash I got this error:
$ git fetch -p Permission denied (public key).
fatal: Could not read from remote repository. Please make sure you
have the correct access rights and the repository exists.
In TortoiseGit I get:
git did not exit cleanly (exit code 1)

For My case i did 3 steps to achieve the sucessful build.
revert all the local changes if any (or just keep a copy of it in case you need it for future use)
Do a git clean up, do a pull and check the logs for error
GO to the git bash option and the error i was getting in log in above stem (i my case )
as "error: cannot lock ref and the branch details", so in the git bash i ran the following command
git update-ref -d 'Branch_name'
For example if the error was something like
**
ISSUE
**error: cannot lock ref 'refs/remotes/origin/EXMPLEISSUE/EXAMPLE-1011_DEMO_web_interface_DOES_NOT_GET_GIT_UPDATE':
Then i ran following command
git update-ref -d 'refs/remotes/origin/EXMPLEISSUE/EXAMPLE-1011_DEMO_web_interface_DOES_NOT_GET_GIT_UPDATE'
We have to ensure all the error in logs to be solved similarly before getting a successful pull by doing git update-ref -d 'Branch_name' and finally i can get the take the successful pull from git.

Related

No access to remote repository

I am deploying my node.js app.
I am using git hooks and creating a remote repository.
In the image below you can see that i have added the remote 'adiproduction' to which i will push from my local repo.
Below i am pasting the image of content in post-receive file of hooks.
Following is the error when i try to push my code on 'adiproduction' remote.
ubuntu#35.154.65.179: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Edit:
I tried running the ssh -Tv ubuntu#35.154.65.179 command. And i got the following output.
try to run the code with "sudo"
sudo helps you to run the command with root privilege
and secondly, if you dont want use sudo so please set the ssh key on your git account, this link will helps you to set the ssh key-
'https://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/'
and lastly if above solution not helps then please delete the current repository and try to clone again useing following command with ssh clone link-
git clone -b
thank you

Issue with GIT command

I am trying to execute git clone command to clone source code from github repository. I am using 2.11.1 version. command I run is
git clone https://username:password#github.com/repository.git ./localpath
This works fine at windows machine. But when I am executing from linux machine command is removing # and throwing error. Execution failure is like
git clone https://username:passwordgithub.com/repository.git ./localpath Cloning into './localpath'...
error: Couldn't resolve host username:passwordgithub.com while accessing
Could someone help me to fix this?
Register your ssh-keygen generated id to Github so it would not prompt you for password.
$ ssh-keygen
No need to enter pass-phrase. Output your public key, then copy it to github
$ cat ~/.ssh/id-rsa.pub
But, if you really want to go that route.
Enclose them in a single quotation, or do them like below.
#!/bin/bash
REPO='https://username:password#github.com/repository.git'
LOCAL_PATH='path/to/wherever'
git clone "$REPO" "$LOCAL_PATH"
Note: Use double quotations for variables

Pull not working - TortoiseGIT / Windows 7 / GIT on Debian + gitolite

i have a weird issue. Im using TortoiseGIT (Win7) and my repositories are placed on a vritual server (Debian), where im using gitolite and SSH keys.
I can clone the repository to my PC, i can run Fetch, Push, Commit, Sync .. everything, but when trying to Pull the changes from server Pushed by other contributor, the following error appears:
git.exe pull -v --progress "origin"
fatal: 'pull' appears to be a git command, but we were not
able to execute it. Maybe git-pull is broken?
git did not exit cleanly (exit code 128)
I don't understand, why just the pull command is not working .. thanks for any help.
I can make a clone of the repository, with the contributed changes .. but can not Pull the changes to created repository on my PC.
I encountered this same issue after changing the git Bash executable sh.exe to be always run as administrator (to get round another problem). It then left git unable to access it under certain scenarios and caused various "Maybe git-* is broken?" errors. Perhaps this might help someone...
Uninstalling old Git and reinstalling the latest build fixed this issue for me.
Here's a link to the installers
Link to get installers
My exact error message was
C:\Program Files (x86)\Git/libexec/git-core\git-pull: line 304: exec: git-merge: not found
fatal: 'pull' appears to be a git command, but we were not
able to execute it. Maybe git-pull is broken?
The error message is very much linked to Git, and comes from help.c:
static const char bad_interpreter_advice[] =
N_("'%s' appears to be a git command, but we were not\n"
"able to execute it. Maybe git-%s is broken?");
That is similar to issue 40 (of another GUI, here terminal-ide).
In that case, it was due to the remote Git installation, which was incomplete
(Comments 3 of issue 19)
git-merge was also missing from install, can be fixed with
$> ln -s git git-merge
in system/bin/
The resolution might not be exactly the same in your case, but it could be related to a faulty Git installation.
I see that you're able to run "git fetch". If you can also run "git merge", running the sequence "git fetch" followed by "git merge" will accomplish the same thing as "git pull".
Source:
http://git-scm.com/docs/git-pull

error 127 when running "git svn init" on cygwin

I'm trying to convert a local SVN repository to git using git-svn under cygwin and failing. This is what happens:
$ git svn init -t tags -b branches -T trunk file:///cygdrive/e/repository/project
init: command returned error: 127
Any ideas?
I installed msysgit and it failed as well, but with a much better error message (Expected FS format '2'; found format '4') which turned up helpful discussions on Google. It seems like git-svn can't handle the local filesystem format of a current TortoiseSVN. The solution is to run svnserve and use the svn: protocol via localhost.

git autodeploy script within post-receive hook on ubuntu

I have an autodeploy bash script to get updated repo to /tmp in 'post-receive' hook on gitosis
#!/bin/bash
PWD=$PWD
REPO_NAME=${PWD##/*/}
cd /tmp
git clone git#atom-desktop:$REPO_NAME
But anytime when I push repository I got error like this:
Host key verification failed.
fatal: The remote end hung up unexpectedly
error: hooks/post-receive exited with error code 128
How to cope with that ?
You can simply do:
git clone --local $REPO_NAME
As git also supports cloning from local directories:
git-clone
For local respositories, also
supported by git natively, the
following syntaxes may be used:
/path/to/repo.git/
file:///path/to/repo.git/
These two syntaxes are mostly
equivalent, except the former implies
--local option.
Sounds like there is a key mismatch in the SSH connection from wherever /tmp is and atom-desktop. What happens if you try to SSH from the machine that /tmp is located at to atom-desktop?

Resources