Why does pip install replaces the "git#" part of path with "****#" when trying to install from github repository? - github

I'm trying to install a certain package from github repository by running
pip install git+ssh://git#github.com/username/package.git
Result is as following:
Collecting git+ssh://****#github.com/username/package.git
Cloning ssh://****#github.com/username/package.git to /some_local_path/
ERROR: Command errored out with exit status 128: git clone -q 'ssh://****#github.com/username/package.git' '/some_local_path' Check the logs for full command output.
For some reason when pip tries to clone the repository, it replaces the "git#" part with "****#" and obviously can't clone anything. With https everything works, but I have to do it with SSH. What's wrong with it and how to solve the issue?

The stars * are probably placeholders to hide the credentials (username and/or password). So most likely the stars are not used (passed to the server), but only shown in the input to hide security sensitive credentials.
As to why it doesn't work, one explanation is that maybe pip, ssh, and/or git figured out that you have credentials (password) associated with that host (github.com) and that username (git), maybe via a configuration file somewhere (pip.conf, .git/config, .ssh/config). Those credentials are automatically picked up and added to the URI (passed to the server), but hidden with stars in the console output. And maybe there is something wrong with those credentials, so that the connection (authentication/authorization) fails.

Related

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

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.

Personal Access Token Not Authentication Failed when pulling code

I am trying to connect to my GitHub repo using a PAT. I followed all the steps and something weird is happening:
This command works:
git ls-remote https://<username>:<PAT>#github.com/<username>/<reponame>
But when I run ANY git command from the command line and get prompted for the username and password (and I enter the PAT instead), I get this error:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: Authentication failed for 'https://github.com/<username>/<reponame>'
I have pasted the PAT on the CL and it pastes just fine. What am I missing here?? I am doing this on a Ubuntu machine.
Also git config credential.helper returns nothing!
Update:
After some googling, I found that Linux stores system passwords in /etc/shadow. For me, this file contains two entries : 'gitlog' and 'gitdaemon' . Could this be the reason why the PAT entry is not working?
Try using it on another machine and see if it works, if so then it might have something to do with your machine but if it doesn't work on other machines, I think you might need to generate a new PAT and try again.

Cannot use git to clone in remote web server

I have created a Github repo to where I push my local changes using Git Bash, without any problems. I can also use Git Bash to connect to my remote web server (shared hosting) and navigate to the folder where I want to clone my Laravel site.
This is where the problems begin. When I do
$ git clone git#github.com:myusername/mylaravelsite.git
I get the error message:
Permission denied (publickey)
After some searching for a solution I found that I should make sure that I have a key by doing this:
$ eval "$(ssh-agent -s)"
Which gave this answer:
Agent pid 122372
Then according to the instructions I should do this
$ ssh-add -l
Which gave me this message:
The agent has no identities
Reading up a bit more I try to add the key again by doing
$ssh-keygen -t rsa
...which generated a key pair that I added with ssh-add, I was prompted for a passphrase which I entered twice.
Now, I still get Permission denied (publickey) when I try to access my github repo with ssh. I should also mention that I have created a new SSH key at the github account where I pasted the key I created (I opened .ssh/id_rsa-pub with notepad and copied the content).
What more can I try?
Finally found the answer in case anyone else has the same problem. It turns out that the public key also must exist in the remote web server (in the .ssh folder I uploaded the same rsa_id and rsa_id.pub files, that I created locally), not only locally and in the Github account.
Once I had figured that out and uploaded those files to the webserver, it worked to clone my github repo :-).

Github Push fatal: repository not found (hyphenated username)

Trying to get started with GitHub for the first time. I was following the instructions on the GitHub website to just set up a simple repository and push the Readme file to it.
I wanted to use the terminal first before using a GUI like Github for Windows. So I'm using MINGW32 as the site suggested. However whenever I go to push my file I get
fatal: repository 'https://github.com/fidflash/Hello-World.git/' not found
I'm sure it's because my username is kid-flash not kidflash. It seems that the terminal is trimming the hyphen out of my username in the URL. I use the hyphen when I type in my username. It even prompts "Password for 'https://kid-flash#github.com': "
any ideas how to keep the terminal (or maybe it's Git doing it) from trimming my username?
thanks
Got a response from GitHub support tonight:
I think the dash is actually missing from the origin remote's URL. Can
you try setting the origin remote with the following command and
pushing again?
$ git remote set-url origin
https://github.com/kid-flash/Hello-World.git
I tried it and it worked perfectly.

Receiving Error Code: 255 when pushing to Mercurial repo from Eclipse Plugin

I am using HgEclipse from here: http://www.javaforge.com/project/HGE
I have created a new repository on my server to test the plugin. I cloned the repository, added some files, committed and attempted to push but received the following error message...
abort: HTTP Error 500: Internal Server Error. Command line:
/home/james/workspace/project:hg -y push http://***#[repository location],
error code: 255
From some Googling I can find that the 255 error is to do with Authentication, but the password is correct, otherwise I wouldn't be able to clone in the first place.
Any help or suggestions would be much appreciated.
Thanks
EDIT:
After updating my system to the latest versions I am now also getting this from the command line when pushing (which was previously working):
abort: HTTP Error 500: Permission denied: .hg/store/data/path-to-file.i
Your webserver can't write into the repository. You can either
change the permissions in the local repo so that the webserver get write permissions there (which means you need to set up write permissions with chmod for all files and directories under (and including) .hg, also you need to set the sticky-bit to all directories)
give the webserver an own repo, which is owned by the server.
Giving the web serve a repo of its own looks like this:
$ sudo bash
# mkdir /srv/repo-base
# chown www-data /srv/repo-base
# cd /srv/repo-base
# su -c "hg clone /path/to/current/repo web-repo-name" www-data
# vi /etc/apache2/sites-available/$SITE_CONFIG_FILE # change the repo path to /srv/repo-base/web-repo-name
# /etc/init.d/apache2 reload
A drawback of this method is that you need to push via http even on the machine with the webserver, since as a normal user you don't have write permissions to the webserver repo.
This answered it for me, although it's a different system set-up: TortoiseHg.
In the Repository Settings -> Server, I set Allow Push to *
This was on a private network so secured behind a firewall.