fatal: could not create work tree dir 'divyanshu': Permission denied - bitbucket

While I was using Git bash this occurred on my screen while putting the local repository to the remote repository what should I do to resolve this?
I went from private to public to understand if there is any issue regarding the secured line but there was the same output displayed. while I was doing this from https:// not ssh.

Related

jenkin git repository getting permission denied(publickey, password) for internal ssh server url

I'm trying to configure flow which include git repository
things to note:
i have a git server running in internal network
my jenkin running on one of the machine in the network so it can access git server through local ip
normally i would go like this with my git command
git remote add origin ssh://username#git-server-ip/path-to-folder
after that it prompt me to type in the password for the above username
and i can work on the git repo like normal
The problems:
in Jenkin i already set up credential with "username and password" type
When i paste in the ssh url into the Repository URL, it take a while and return error:
Failed to connect to repository ...
stdout: stderr: Permission denied, please try again. Permission
denied, please try again. username#git-server-ip: Permission denied
(publickey, password). fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
i had selected credentials and double check username and password it's correct. i tried running the ls-remote command manually in the terminal
git ls-remote -h -- ssh://username#git-server-ip/path-to-folder HEAD
it prompts to input the password, i typed it in and it run normal without error
Why is the error only happens on Jenkins when i input the repo ssh url? is username and password credential the wrong approach for credential? what else should i use?
there no guide online for Jenkin with internal git ssh url as i known of
the closest i can see my problem related to is this question Jenkins Git ssh setup does not let me use username/password , but it doesn't have an accepted answer yet, and the answer suggest going with "ssh username and private key"

Bitbucket/Github: permission denied public key

when I am trying to clone a rails app repo I have got permission to, I am getting this issue.
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Even after adding public key by generating one, I am unable to solve this.
Although I am able to clone using he https method but after making changes, the same error comes while I try to push the code.
Please suggest an answer for this.
First, cd into your .ssh directory. Open up the terminal and run:
cd ~/.ssh && ssh-keygen
Second, you need to copy this to your clipboard:
cat id_rsa.pub | pbcopy # On OSX
cat id_rsa.pub | xclip # On Linux
Third, add your newly generated ssh key to your account via the github/bitbucket website (just paste there).
Next, setup your git config:
git config --global user.name 'your_user_name'
git config --global user.email 'your_email'
Finally, restart your command line to make sure the config is reloaded.
Now, you should be able to clone and push from/to your github repository.
For more information on this, see this github page or this bitbucket page.
When attempting to clone, push, or pull over SSH with Git, you may receive one of these messages if Bitbucket couldn't authenticate with the keys that your SSH agent offered.
Here are the most common reasons why you may see these messages:
You used sudo when attempting the connection
You shouldn't use sudo when cloning, pushing, or pulling because the ssh-agent runs on the user level, not the root level.
Your public key isn't loaded into Bitbucket
To check if your public key is loaded into Bitbucket, do the following:
From Bitbucket, choose Personal settings from your avatar in the lower left.
The Account settings page displays.
Click SSH keys.
The SSH keys page shows a list of any existing keys.
If you don't have any keys listed, you can follow our Set up an SSH key documentation to set one up.
Your key isn't loaded into your SSH agent
If your SSH agent doesn't know to offer Bitbucket a key, the connection fails. You may run into this issue if you've recently restarted your system.
You can refer to this Article for more informations:
https://support.atlassian.com/bitbucket-cloud/docs/troubleshoot-ssh-issues/
Check few things.
Is the generated new key is the one your ssh agent using when trying to ssh to server.
(Your ssh agent might be using a different key than the one you generated)
use this to list currently loaded keys by agent.
ssh-add -L
You properly added public key to your repository hosting location.
The keys corresponding to above 1 and 2 should match.
Please see this article: GitHub: Generating SSH Keys. What happens when you run:
ssh -T git#bitbucket.org
?
You may have added the wrong key to authenticate with.
I faced this error when I created another repository in my local. My ssh-keys were already set up and I was trying to push code through vs code.
The issue got resolved when I git push-ed through git bash like I was doing before.
For bit bucket I think I have tried everything with ssh. I have tried the answer from this stackoverflow question as well. But it doesn't work. So finally I just changed the clone command from SSH to HTTPS and it worked. Only then it asked for password for my account.

ssh connection failing when pushing on a Gitlab repo

I have installed GitLab. Suppose I installed it in /home/myuser/gitlab.
I created a new project
I was told to create a repo "test" I put in /home/myuser/gitlab/test
I added some SSH key in /home/myuser/.ssh
Then I initialized a Git repo in /home/myuser/gitlab/test.
Following instructions, I added a remote git#localhost:root/testing.git
but when I try to push, I get this error message:
$ git push -u origin master
ssh: connect to host localhost port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
I installed GitLab in OS X and I have other SSH keys in /home/myhome/.ssh, I have set up the user email and name inside /home/myuser/gitlab/.git/config, (and set those globally just for testing) and the server is launched from /home/myuser/gitlab. Does anybody have an idea where this error comes from?
If I run ssh git#localhost, I get
/home/myhome/.ssh/config line 4: garbage at end of line; "home".
where in this file I have some settings for a remote server for another project. I think it is the problem but I don't really know how to fix it.
Update : Here's the content of my ~/.git/config file
Host remote_test_server
Hostname remote_test_user#ftp.remote_test_server
IdentityFile ~/.ssh/id_rsa_stf.pub
User <your home acct>
/home/myhome/.ssh/config line 4: garbage at end of line; "home".
That would prevent any ssh command to properly function, because of a parasite echo done by the remote session.
Check your .profile or other .rc files, and see if any echo is done in those.
Or at least, test with ssh -T git#localhost, in order to disable any TTY allocation.
check also the content of your .ssh/config file, which doesn't seem to be properly formatted.
See this example of a config file:
User should be the login name of the account used for the ssh session on the rmeote server.
It should not be the homedir path.
IdentityFile should reference the private key (~/.ssh/id_rsa_stf), not the public one!
Hostname should reference the remote server 'ftp.remote_test_server', not the user#remoteServer.

git clone through ssh returns Permission denied (publickey,password)

I have production_server and git_repo_server,
git_repo_server .ssh/authorized keys have production user id_rsa.pub.
When I ssh to production_server and make git clone - it works fine, don't ask any password.
When I try to clone git repo to production_server on my local mashine using ssh I see:
Permission denied, please try again.
Permission denied (publickey,password).
It looks like ssh should be configured to send commands to remote server. But I don't know how to do it. Thanks for any help!
Problem was fixed. I added
Host *
ForwardAgent yes
to /etc/ssh/ssh_config
See ssh-agent tutorial
I had this issue the probelm was that the user/machine from which I'm accessing Gitosis was not registered as a user in the Gitosis project, and thus access was denied.
If you don't have one, generate SSH key in your machine "~/.ssh$ ssh-keygen -t rsa".
Use scp command to copy your public key (id_ras.pub) to gitosis_server, to gitosis_admin/keydir.
Make sure you rename id_rsa.pub to USER#SYSTEM.pub, USER = the client user, SYSTEM= the client system name.
Follow instructions here to add the user (USER#SYSTEM) to the project [https://help.ubuntu.com/community/Git#Adding_users]

git remote push : Permission denied (publickey,keyboard-interactive)

I have been trying to set up a staging machine to run project at home (rails application).
# Remote machine connection
REPLOGIN=joel
REPADDRESS=192.168.2.100
REPLOCATION=/Users/joel/Projects/bio_watts #Repo location
REPNAME=biowatts
# Copy the repo to the server
echo "Copying the git repo to the server $REPADDRESS"
echo "repname:$REPNAME"
TEMPREP="$REPNAME.git"
echo "$TEMPREP"
git clone --bare .git $TEMPREP
scp -r $TEMPREP $REPLOGIN#$REPADDRESS:$REPLOCATION/
# Set up the origin for the project
#echo "Linking current repository to remote repository"
git remote add imac $REPLOGIN#$REPADDRESS:$REPLOCATION/$REPNAME.git/
All this worked fine
$git remote
imac <== this is my remote machine
When I try to git push to this machine I get:
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly
I know there is something about SSH ... but I don't understand what I need to do on my local and on my remote machines (Mac OS X Lion).
Can someone help?
Cheers,
Joel
NEXT QUESTION:
On my remote machine I do find my cloned biowatts.git file ... but I don't see the project files (rails app) ... how does it work?
My intent is to git push to my imac and run my app there (thin start) ???
Do I need to copy my file manually? I assumed that the git clone would copy every I needed ...
Your remote git server should know your machine via your iMac's public ssh key and should have a config somewhere allowing you to push (write rights).
That remote machine needs to know about your ssh keys.
You need to generate a key locally (if you don't have one) and then add the public key to the remote server's ~/.ssh/authorized_keys
You can follow the GitHub tutorial on setting up keys (if you don't already have them set up).
http://help.github.com/mac-set-up-git/
Instead of Step 4. Add your SSH key to GitHub, you'll need to add your key to the authorized_keys file on the server.
In the future, for those of you encountering this in assembla specifically, the solution is to copy your ~/.ssh/id_rsa.pub to the assembla profile. This post gives step by step instructions.

Resources