Error in the checkout of a Github using Subversion with SSH - Linux Command line - github

Github recently enforced a no password rule with their repository access. I can't do two factor authentication, so, I am stuck with SSH keys. I want to use subversion, but when I try to checkout my repo, using:
svn co "svn+ssh://git#github.com/Oiubrab/ozzymandais.git"
I get the error:
Invalid command: 'git#github.com svnserve -t'
You appear to be using ssh to clone a git:// URL.
Make sure your core.gitProxy config option and the
GIT_PROXY_COMMAND environment variable are NOT set.
svn: E170013: Unable to connect to a repository at URL 'svn+ssh://git#github.com/Oiubrab/ozzymandais.git'
svn: E210002: To better debug SSH connection problems, remove the -q option from 'ssh' in the [tunnels] section of your Subversion configuration file.
svn: E210002: Network connection closed unexpectedly
From the research I've done, I think I need to edit the /home/user/.subversion/config file, but i have no idea how and there is no documentation as to how to use svn with github with ssh. I have setup an ssh key and popped it on my github account. I just need to know how to setup the subversion tunnel to github.

I don't think that github supports the svnserve protocol.
AFAIK, you should generate a personal access token (PAT) in GitHub and use it as a password in the Subversion client. I.e., enter your PAT when the client prompts you for a password.

Related

How to clone github private repository in cpanel (shared host without terminal or ssh)?

I have a shared host and they don't give me ssh or terminal for it.
I've tried to clone my private repos from git by Git™ Version Control so I am using ssh link because they need permission. I don't know how to make ssh key on cpanel so I can make it from my mac and upload to cpanel and also add to Github.
But when running, they give me error: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists..
I'm a beginner for using Git & StackOverflow, so please let me know if there's anything wrong with the question I've asked. Thanks!
Tried Url with password
Cloning a private Github repo and
having a response "The clone URL cannot include a password."
This is different than what worked for the OP (hopefully they put their solution in an answer here).
I was able to solve this problem by installing an external SSH client (like PuTTY for Windows) and then SSH into my website using its IP address. Then I followed these steps from cPanel to connect the private repository.

How do I push/pull from Github over openconnect vpn with github ssh auth?

I'm using openconnect in Ubuntu 16.04 LTS to ssh into a remote machine over a vpn. I'm trying to push and pull to/from Github with ssh authentication, but it's not working. When I try to pull or push, it gives the error:
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
When I connect with nomachine, I'm able to push/pull with Github no problem.
I've tried googling many different things, and haven't noticed anything yet in the options for openconnect or ssh that would help.
Any ideas?
The answer was simple: just set the git url to use the https version instead of ssh. You can also then cache the username/pass for https for a while: https://help.github.com/articles/caching-your-github-password-in-git/

Private Github Repositories with Envoy

Anybody has any problems deploying with Laravel's envoy when using private Github repos?
When manually cloning my repo from the production server, the ssh key seems to be accessible but when using Envoy, I always get a "Permission denied (publickey) error.
Thanks
It is probably because the ssh key on your remote server requires a password.
If you change the Envoy.blade.php to perform some other task you should be able to establish whether you are connecting to your remote correctly.
#servers(['web' => 'user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Should return something like:
[user#domain.com]: On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean
If you are connecting using a Mac or Linux you probably don't have to enter your password because your terminal is using ssh-agent which silently handles your authentication.
Wikipedia article on ssh-agent
When connecting over ssh, ssh-agent isn't running and the script is being prompted for a password which is where it is failing.
To get around this you could to generate a new key on the remote machine that doesn't use a password.
If you want to restrict the ssh key to a single repository on GitHub have a look at deploy keys
You need to pass the -A (as per the man page it - Enables forwarding of the authentication agent connection. This can also be specified on a per-host basis in a configuration file) in you ssh string.
You will also need add your ssh key for agent forwarding (on the machine which can access the git remote which I assume be your localhost)
ssh-add -K ~/.ssh/your_private_key
Something like this
#servers(['web' => '-A user#domain.com'])
#task('deploy')
cd /path/to/site
git status
#endtask
Git remote commands should now work.

GitHub: invalid username or password

I have a project hosted on GitHub. I fail when trying to push my modifications on the master. I always get the following error message
Password for 'https://git#github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://git#github.com/eurydyce/MDANSE.git/'
However, setting my ssh key to github seems ok. Indeed, when I do a ssh -T git#github.com I get
Hi eurydyce! You've successfully authenticated, but GitHub does not provide shell access.
Which seems to indicate that everything is OK from that side (eurydyce being my github username). I strictly followed the instructions given on github and the recommendations of many stack discussion but no way. Would you have any idea of what I may have done wrong?
After enabling Two Factor Authentication (2FA), you may see something like this when attempting to use git clone, git fetch, git pull or git push:
$ git push origin master
Username for 'https://github.com': your_user_name
Password for 'https://your_user_name#github.com':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/your_user_name/repo_name.git/'
Why this is happening
From the GitHub Help documentation:
After 2FA is enabled you will need to enter a personal access token instead of a 2FA code and your GitHub password.
...
For example, when you access a repository using Git on the command line using commands like git clone, git fetch, git pull or git push with HTTPS URLs, you must provide your GitHub username and your personal access token when prompted for a username and password. The command line prompt won't specify that you should enter your personal access token when it asks for your password.
How to fix it
Generate a Personal Access Token. (Detailed guide on Creating a personal access token for the command line.)
Copy the Personal Access Token.
Re-attempt the command you were trying and use Personal Access Token in the place of your password.
Related question:
https://stackoverflow.com/a/21374369/101662
https://git#github.com/eurydyce/MDANSE.git is not an ssh url, it is an https one (which would require your GitHub account name, instead of 'git').
Try to use ssh://git#github.com:eurydyce/MDANSE.git or just git#github.com:eurydyce/MDANSE.git
git remote set-url origin git#github.com:eurydyce/MDANSE.git
The OP Pellegrini Eric adds:
That's what I did in my ~/.gitconfig file that contains currently the following entries [remote "origin"] url=git#github.com:eurydyce/MDANSE.git
This should not be in your global config (the one in ~/).
You could check git config -l in your repo: that url should be declared in the local config: <yourrepo>/.git/config.
So make sure you are in the repo path when doing the git remote set-url command.
As noted in Oliver's answer, an HTTPS URL would not use username/password if two-factor authentication (2FA) is activated.
In that case, the password should be a PAT (personal access token) as seen in "Using a token on the command line".
That applies only for HTTPS URLS, SSH is not affected by this limitation.
Solution steps for Windows users:
Control Panel
Credential Manager
Click Windows Credentials
In Generic Credential section ,there would be git url, update username and password
Restart Git Bash and try for clone
Note:
If you didn't find git url in Generic Credential section then follow below answer
https://stackoverflow.com/a/55858690/7372432
If like me you just updated your password and ran git push to run into this issue, then there's a super easy fix.
For Mac users only. You need to delete your OSX Keychain access entries for GitHub. You can do it via terminal by running the following commands.
Deleting your credentials via the command line
Through the command line, you can use the credential helper directly to erase the keychain entry.
To do this, type the following command:
git credential-osxkeychain erase
host=github.com
protocol=https
# [Now Press Return]
If it's successful, nothing will print out. To test that it works, try and clone a repository from GitHub or run your previous action again like in my case git push. If you are prompted for a password, the keychain entry was deleted.
When using the https:// URL to connect to your remote repository, then Git will not use SSH as authentication but will instead try a basic authentication over HTTPS. Usually, you would just use the URL without a username, e.g. https://github.com/username/repository.git, and Git would then prompt you to enter both a username (your GitHub username) and your password.
If you use https://something#github.com/username/repository.git, then you have preset the username Git will use for authentication: something. Since you used https://git#github.com, Git will try to log in using the git username for which your password of course doesn’t work. So you will have to use your username instead.
The alternative is actually to use SSH for authentication. That way you will avoid having to type your password all the time; and since it already seems to work, that’s what you should be using.
To do that, you need to change your remote URL though, so Git knows that it needs to connect via SSH. The format is then this: git#github.com:username/repository. To update your URL use this command:
git remote set-url origin git#github.com:username/repository
Instead of git pull also try git pull origin master
I changed password, and the first command gave error:
$ git pull
remote: Invalid username or password.
fatal: Authentication failed for ...
After git pull origin master, it asked for password and seemed to update itself
2FA is enabled and getting error remote: Invalid username or password.
fatal: Authentication failed for
If you set 2FA is enabled in GitHub you will need to enter a personal access token instead of a 2FA code and your GitHub password.
How to fix it
https://github.com/settings/tokens generated token
Copy the Personal Access Token
Now enter Personal Access Token in the place of your password during git operation
just try to push it to your branch again. This will ask your username and password again, so you can feed in the changed password. So that your new password will be stored again in the cache.
This is the answer.
Set the github token:
https://github.com/settings/tokens
And then:
git remote set-url origin https://[token]#github.com/your_repository
I am getting this while cloning app from bitbucket:
Cloning into 'YourAppName'...
Password for 'https://youruser id':
remote: Invalid username or password
I solved it. Here you need to create password for your userid
Click on Your profile and settings
Then Create app password choose your name password will generated ,paste that password to terminal
That problem happens sometimes due to wrong password. Please check if you are linked with AD password (Active Directory Password) and you recently changed you AD password but still trying git command with old password or not.
Update old AD password
Control Panel > Credential Manager > Windows Credential > change github password with my new AD password
I have got the success using the following commands.
git config --unset-all credential.helper
git config --global --unset-all credential.helper
git config --system --unset-all credential.helper
Try and let me know if these are working for you.
No need to rely on Generating a Personal Access Token and then trying and use Personal Access Token in the place of your password.
Quick fix is to set your remote URL to point to ssh not https.
Do this git remote set-url origin git#github.com:username/repository
I did:
$git pull origin master
Then it asked for the [Username] & [Password] and it seems to be working fine now.
If you have just enabled 2FA :
Modify hidden config file in ./git hidden folder as follow :
[remote "origin"]
url = https://username:PUT_YOUR_2FA_TOKEN_HERE#github.com/project/project.git
Try this:
# git remote set-url origin git#github.com:username/repository
Run Below command, and after than on every push and pull it will ask you to enter the username and password.
git config credential.helper ""
now when you pull/push you will be asked for git credentials. weather you are running through command prompt or Intellij Git.
Disabling 2 factor authentication at github worked for me.
I see that there is a deleted answer that says this, with the deletion reason as "does not answer the question". If it works, then I think it answers the question...
You might be getting this error because you have updated your password. So on Terminal first make sure you clear your GitHub credentials from the keychain and then push your changes to your repo, terminal will ask for your username and password.
In case you get this error message in this situation:
using github for entreprise
using credential.helper=wincred in git config
using your windows credentials which you changed recently
Then look at this answer:
https://stackoverflow.com/a/39608906/521257
Windows stores credentials in a credentials manager, clear it or update it.
Control panel
Credential manager
Look for options webcredentials and windows credentials
in either one you will find github credentials fix it with correct credentials
open new instance of git bash you should be able to perform your git commands.
This worked for me, I was able to pull and push into my remote repo.
I had the same issue. And I solved it by changing the remote branch's path from https://github.com/YourName/RepoName to git#github.com:YourName/RepoName.git in the repo's settings of the client app.
I'm constantly running into this problem.
Make sure you set git --config user.name "" and not your real name, which I've done a few times..
I just disable the Two-factor authentication and try again. It works for me.
Since you probably want to keep 2FA enabled for your account, you can set up a ssh key and that way you won't need to type your Github credentials every time you want to push work to Github.
You can find all the ssh setup steps in the documentation. First, make sure you don't currently have any ssh keys (id_rsa.pub, etc.) with $ ls -al ~/.ssh
I fixed my issue by installing GitHub CLI and running gh auth login
See:
https://docs.github.com/en/get-started/getting-started-with-git/caching-your-github-credentials-in-git#github-cli
I had the same issue
$ git clone https://github.com/sample-url.git
Cloning into 'Project'...
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/sample-url.git/'
I just git init first and then git clone <clone-url>
git init
git clone https://github.com/your-clone-Url
It worked for me.
There is a issue on Windows using cmd-Greetings
There is a issue on Windows using cmd-Greetings who will not let you clone private repositories. Remove that cmd-greeting described in this documentation (keyword Command Processor):
Known-Issues
I can confirm that other clients like SourceTree, GitKraken, Tower and TortoiseGit affected to this issue too.
There are many reasons why this might happen. In my case, none of the solutions worked. In particular, git pull origin master did not ask me for my username and password.
I was on Windows with a github password recently changed. I was using the credential manager to manage my password. Here is what worked for me:
Confirm you are using the credential manager for git:
git config --list
…
credential.helper=manager
Run a new command prompt as administrator
List all stored credential with cmdkey /list from C:\WINDOWS\system32>
Remove the github target with cmdkey /delete:<target name>. In my case, the target name was github.<companyname>.com
Open a new prompt and run a git command. You should get a popup asking for your usernmame and password. After providing the new credentials, it won't ask you for it again.
When I faced this issue all I did to resolve it was to Generate new token from my github dashboard and paste the following code in my terminal
$ git remote set-url origin https://your-github-username:your-github-token#github.com/your-github-username/your-github-repo.git

connecting to github through server permission denied (public key)

I am connecting to github through my ftp server. I added the public key generated by my server then tried to connect and it is still giving me "permission denied", I attached a screenshot below.
You cannot just ssh into githubs servers in this way. Github's SSH server allows you to use git through their servers, not shell access. You get "permission denied" because you login with user github instead of git.
After adding your SSH public key to Github (which you've done correctly), just use git with the SSH remote.
If you have not a local repo yet, just use something like:
git clone git#github.com:Bumblebee-Project/Bumblebee.git
Otherwise, add a new remote to your existing git repo:
git add origin git#github.com:Bumblebee-Project/Bumblebee.git
After that, push your local repo with:
git push
See also http://help.github.com/remotes/