Sourcetree showing this error 'git status' failed with code -1" while trying access project from bookmark, also I can't clone any other project from remote list or manual by url.
SSH connection is good. Command
ssh -T git#github.com showing - Hi "name"! You've successfully authenticated, but GitHub does not provide shell access.
Command git clone also works fine and fetch project.
Resolved by clicking options > git > Use System Git and set to use System Git Version.
Related
I have generated and added my SSH key into Github.
Now I'm trying to write a script which generates a new private repository in Github and upload intiial files. User will be prompted for the name of the new repository.
The code that I have is given below. The problem is that when trying to push files into Github I get the following error
ssh: Could not resolve hostname github.com:rongardF: Name or service not known
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Why do I get this error? Is there anything else that I have to do?
The code:
#echo off
set /p name="Enter new project name: "
touch README.md
touch .gitignore
echo __Previews>>.gitignore
echo History>>.gitignore
echo Project Outputs *>>.gitignore
echo * Logs *>>.gitignore
git config --global user.email "r****n#gmail.com"
git config --global user.name "R** F****"
curl -u r***F:p*****d https://api.github.com/user/repos -d "{\"name\":\"%name%\",\"private\":true}"
git init
git add .
git commit -m "Initial commit"
git remote add origin git#github.com:r***F/%name%.git
git push -u origin master
NB: The names obviously don't include "*" symbol, this is just for blurring out my details.
git remote add origin git#github.com:r***F/%name%.git
For testing, you can check if this syntax would work in your case
git remote add origin ssh://git#github.com/r***F/%name%.git
Check also if a simple ssh -Tv git#github.com works (meaning if it display a Welcome message at the end)
Thanks for the suggestion #VonC
I got it to work by adding the following line before the push command:
git remote set-url origin https://github.com/r****F/%name%.git
Not sure why, but this works. So the snippet of the final code is:
...
...
git init
git add .
git commit -m "Initial commit"
git remote add origin git#github.com:r****dF/%name%.git
git remote set-url origin https://github.com/r****F/%name%.git
git push -u origin master
I'm trying to run a CircleCI test job locally by running
circleci local execute --job test
However, I'm getting this error message:
go: github.com/some/repo#v0.0.0-20180921204022-800easdf7ec: git fetch -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in /go/pkg/mod/cache/vcs/52f8e69c46f5a1cc77e6bf: exit status 128:
fatal: could not read Username for 'https://github.com': terminal prompts disabled
I would basically like to do the equivalent of https://circleci.com/docs/2.0/add-ssh-key/ for the local CircleCI environment, but there is no way to go to Project Settings -> Checkout SSH Keys as described in that documentation. I've read the documentation at https://circleci.com/docs/2.0/local-cli/#run-a-job-in-a-container-on-your-machine but wasn't able to find a way to do this.
Any idea how I can check out code from private Github repos in the local CircleCI environment?
Have you tried adding the key to your SSH keychain?
ssh-add (location of ssh key)
This should add it to the keychain and CircleCI local should pick it up.
You can use --checkout-key argument
circleci local execute build --checkout-key id_rsa
Note: id_rsa should be in the same folder
I'm trying to automatically deploy my app to digital ocean through bitbucket pipelines. Here are the steps my deployment is following:
connect to the remote digital ocean droplet using ssh
clone my repository by running a git clone with ssh
launch my application with docker-compose
I have successfully setup ssh access to my remote. I have also configured ssh access to my repository and can successfully execute git clone from my remote server.
However, in the pipeline, while connection to the remote server is successfull, the git clone command fails with the following error.
git#bitbucket.org: Permission denied (publickey).
fatal: Could not read from remote repository.
Anybody has an idea of what is going on here?
Here is my bitbucket-pipelines.yml
image: atlassian/default-image:latest
pipelines:
default:
- step:
deployment: production
script:
- cat deploy.sh | ssh $USER_NAME#$HOST
- echo "Deploy step finished"
And the deployment script deploy.sh
#!/usr/bin/env sh
git clone git#bitbucket.org:<username>/<my_repo>.git
cd my_repo
docker-compose up -d
Logs for the git clone ssh commands within the droplet and from the pipeline
Git uses the default ssh key by default.
You can overwrite the SSH command used by git, by setting the GIT_SSH_COMMAND environment variable. You can add the -i argument to use a different SSH key.
export GIT_SSH_COMMAND="ssh -i ~/.ssh/<key>"
git clone git#bitbucket.org:<username>/<my_repo>.git
From the git documentation:
GIT_SSH
GIT_SSH_COMMAND
If either of these environment variables is set then git fetch and git push will use the specified command instead of ssh when they need to connect to a remote system. The command-line parameters passed to the configured command are determined by the ssh variant. See ssh.variant option in git-config[1] for details.
$GIT_SSH_COMMAND takes precedence over $GIT_SSH, and is interpreted by the shell, which allows additional arguments to be included. $GIT_SSH on the other hand must be just the path to a program (which can be a wrapper shell script, if additional arguments are needed).
Usually it is easier to configure any desired options through your personal .ssh/config file. Please consult your ssh documentation for further details.
versiont Control > GitHub > "Test Successufl"
IMG1
Git version : 2.18.0
SSH ececutable: Native
IMG2
BUT!!
git clone fail
IMG3
I don't know why this happens any help would be appreciated.
You are cloning via HTTP. SSH executable is not related.
Check if it works in the command line first. It could happen there is git credential.helper that somehow saved wrong credentials and git is trying to use them.
You could use SSH instead, but make sure SSH keys are registered on GitHub and, since you want to use native SSH client, the key is added to ssh-agent or does not have a passphrase, because IntelliJ is not a terminal and cannot handle interactive prompts for passphrases.
Everybody Thanks~
I resolved it in the following way.
Step 1. Create SSH Key (in Local PC)
My PC use Windows.
So, I use Git Bash.
Step 2. Register GitHub
Personal settings > SSH and GPG Keys
Nes SSH Key > XXX_rsa.pub (This contens is Created SSH Key File in Local PC)
Step 3. In intellij, Git Clone used "Use SSH" instead of "Use HTTPS".
I have a problem when I'm trying to clone with git on cygwin. My GIT_SSH is
"C:\ProgramFiles(x86)\Git\bin\".
When I try to clone, here is the result:
$ git clone ssh://*****/home/local/git/prestashop myDirectory
Cloning into 'myDirectory'...
error: cannot spawn C:\ProgramFiles(x86)\Git\cmd\: No such file or directory
fatal: unable to fork
I've seen many question related to that problem but I can't find answers to solve this problem. All ideas welcome ! Thanks !
Following Git with SSH on Windows, you see that GIT_SSH should reference the ssh executable, not just its path:
(old msysgit)
set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
(new 2015 git for Windows)
set GIT_SSH=C:\Program Files\Git\usr\bin\ssh.exe
In my case, since I was using Git Extensions (3.3.1), I had adjust my SSH Client path.
Todo so, I went to Menu Tools > Settings > Git Extensions (category on left side) > SSH and adjusted my SSH Client path to C:\Program Files\git\usr\bin\SSH.EXE
Update 1
Facing this issue once again, after switching to Putty, because Pageant allows me to set my private once a day without exposing outside, where I've forgot set Putty as my ssh client, by going to Tools > Settings > Git Extensions (category on left side) > SSH > And setting Putty as my ssh client