Problems with _netrc, still getting clone failed - git-gui

I've followed this tutorial on setting up git-gui so I can get access to google code git repositories but I am still getting clone failed. I really don't understand the problem. I have made a _netrc file and I have created a HOME environmental variable yet the problem is still there.
Is there anyone out there who could shed some light on this situation? It would be much appreciated. Thanks.

You can debug the process with a:
set GIT_CURL_VERBOSE=1
git clone https://code.google.com/p/yourProject
Your environment variable %HOME% should reference an existing directory (not necessarily C:\HOME as in the tutorial, but any path you want), where _netrc has been created.
Then, make sure your %HOME%\_netrc file does contain:
machine code.google.com
login (your Gmail login, which is usually your email address)
password (your Gmail password)

Related

Log in to Github via Fedora Server 37

I am using Mac OS as my main operating system. I installed fedora 37 server edition in a VMware workstation as part of my course in college. I am trying to customize my prompt using this repo https://github.com/andresgongora/synth-shell.
I have installed git already. I also have power line-fonts installed. The issue I am having comes with this command: git clone --recursive https://github.com/andresgongora/synth-shell.git
When typed and executed I get a prompt asking me for a GitHub username and password. I enter my credentials and I get an error stating "Authentication Failed for https://github.com/andresgongora/synth-shell.git" even though my credentials are correct.
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global username and that doesn't work either.
Am I supposed to log in to my GitHub before cloning this repo? Does anyone else experience this or have a workaround?
I have tried putting my username and password (both combinations separately) and I get an event error. I configured a global git username and that doesn't work either.
Sites used:
Can't clone a github repo on Linux via HTTPS
https://docs.github.com/en/get-started/getting-started-with-git/setting-your-username-in-git
https://documentation.red-gate.com/soco/troubleshooting/authentication-failed-when-cloning-from-github
Edit: I have also tried setting up a token to log in with. The only issue I am having is my linux distro does not support copy and paste so I am having to type everything out. When the password prompt comes up everything is blank to hide your password so I can't even check for spelling errors.
As of mid 2021, github the company is now enforcing git HTTPS authentication to use an access token rather than username+password. See this stackoverflow answer for full information.
One way forward is to generate an SSH key, and upload the public portion to github.
It warrants mentioning that this change is specific to Github Inc., the Microsoft subsidiary. There have not been any changes to git, the distributed version control system. Other, similar repository hosting services may not necessarily bar you from authenticating via username+password. Gitlab is one example.
I managed to fix my issue by using cockpit in my web browser. Doing this allowed my to copy and paste my information and everything worked first try.
Beginner problem.

Git push asks username & password for HTTP repo origin

I am working on a project of mine and I got the codes uploaded in github. I started working in this project from Win10 os and currently I'm working in Arch linux. In windows it didn't use to ask me for any password but it does now.
I've never pushed from my linux before. Today when I tried to push the terminal and VB code both are asking for my github username and password.
I kept a backup of this project at my usb hard drive and currently I pasted it in my linux ssd. What I'm saying is I didn't clone it from the repo. As far as my global username & user email are concerned both are accurate. I'm not using any SSH so when I type git remote -v in my terminal it shows https link as the origin for both fetch and push.
Why is it asking for my username and password? Is it secure to provide my password? In case if I provide my credentials then do I have to provide it every time I push? How to fix this?
I have searched stackoverflow for solution but the other questions that I have found doesn't match my criteria cause in windows it was working fine without asking any credentials.
So, I have updated my origin remote from https to ssh and added a ssh public key to my github account after creating one which is well defined by github finally my problem solved and now I can push to my repo without any credential prompt by the terminal. Thank you Code-Apprentice.
While in general, providing a username and password to git is secure, GitHub no longer allows authentication with username and password. Instead, you need to either use ssh or generate a personal access token.
See source for details.
Why people are editing my posts I don't understand. I'm trying to post a solution of the problem that I have faced previously. Then why people are editing my posts? I just want to put a proper solution for the future so that people get benefited from this. However, the solution of the problem is you have to do ssh push then it won't prompt for username & password anymore. That's all. Now please do not edit my post. I am not even sure how you are allowed to do that!

Can't switch GitLab accounts for command-line Git

This might be flagged as a duplicate, I've tried all the fixes in the similar questions that popped up on the search, but none worked.
Basically, I was using my company's GitLab account to do my pushing, but decided to switch to my personal account for some reasons. Except I can't find a way to do that.
The ~/.git-credentials file doesn't exist, when I try to open it nano just gives me a new file. The ~/.git-config file already contains my personal account's email and username (but no password), and my commits on the repository page on GitLab are attributed to my personal account. However, Git never asked for the password (so I doubt it's actually logged in). Also, the contributions aren't showing up on my personal Overview page (the little colorful calendar thingy), instead they are showing up on the previous account's Overview page.
I also tried these two (separately):
git config --global --unset credential.helper
git credential-cache exit
No changes whatsoever. Still letting me push without asking for credentials, and commits still showing up on the wrong account's Overview.
I checked out the git-credential-store documentation as well (as suggested in a similar question), and for whatever it's worth, $XDG_CONFIG_HOME is empty and $HOME/.config/git/ doesn't exist either.
Someone else suggested going to Access Tokens on the GitLab website and deleting the corresponding token there, but it says "This user has no active access tokens."
I even tried ye olde uninstalling and reinstalling Git and it changed absolutely nothing.
I'm at my wits' end. Any idea where these darned credentials might be stored, or a way to force logout?
EDIT: A coworker partially fixed it for me. I had both accounts authenticated via SSH, and GitLab was only using the one I connected first, which was the corporate account.
I deleted both SSH keys, generated a new pair and this time authenticated only my personal account. It's working now. I wanted a way that I could switch between accounts (I have to use both) without having to re-authenticate via SSH every time, and if anyone still has an idea, I'm open to it.
The repos are cloned via SSH. Which is strange, because even then, the first time I pushed, it asked me for username and password. Only that time and then never again.
That looks like HTTPS URLs though. Check that with a git remote -v inside the repository.
Any credential helper setting that you would manipulate would only influence HTTPS URLS.
It is is SSH, then you would need to change those URLS to use an ~/.ssh/config entry
Host <HostEntry>
Hostname xxxx.xx.xx
User ubuntu
IdentityFile ~/.ssh/my_second_key.pem
With the new URL being:
ssh <HostEntry>

Gitlab clone showing an error: The project you were looking for could not be found

I have installed the GitLab community edition on my centos 7 server. When I try to clone a repository it shows remote: The project you were looking for could not be found. Please help with this.
Thanks in advance
Possible reasons:
you have entered wrong credentials, try using ssh clone by adding your key in gitlab settings
you do not have required authorization to access that repo, try accessing it via the browser first
that repository don't exists, create it
Maybe a domain name resolution issue? A network issue?
Is there a software firewall installed that forbids the terminal from making network call?
Possible network issues
My first hunch is a network issue or domain name resolution issue.
If you can connect at all to the repository, you should at least get a username and password challenge. If it was a credentials issue, you would at least get to that point.
Can you ping the URL? What if you use the IP address instead of the domain name? Just two things to try.
Dig into the porcelin
GitLab does provide a porcelin rake command that allows you to check connectivity. You might want to give this a try as part of your troubleshooting routines.
sudo gitlab-rake gitlab:tcp_check[ibm.com,80]

Version control on shared web host with Bazaar

I have a project I am going to begin co-developing on one of my web servers. Due to the nature of this kind of thing I'd like to have some version control going on. I've been searching all day for something that fits my needs and Bazaar seems the way to go, but I cannot figure out how to configure it.
My web host is Linux, without SSH (or SFTP as far as I can tell). I've read that you can use Bazaar in this situation to make a "dumb" server, but I can't for the life of me figure out how to configure, or find a guide. Everything out there requires either SSH/CLI access (both of which I don't have) or are too vague to follow. I am using the Windows GUI for Bazaar as well.
Can anyone either point me to a guide/instructions on how to do it, or post one here?
Edit Since Original Post
I have been trying to do several things since my original post. It might be that I am misunderstanding how bazaar is meant to work. What I want is to have my php files etc. on my web host (to which i do not have ssh access) so that myself and codevelopers can edit and test files without overwritting each other.
I initially tried to "start a new project" on my server via "ftp://user:pass#server" and it says that is successful. Then it prompts with a "Unable to open location" error saying "C:/ftp:/user:pass#server is not a brand, checkout, or repository.
Do you want to open it as a virtual repository, searching for nested locations?"
When I hit yes, it gives me an error "Unable to change to C:/ftp:/user:pass#server - closing page."
if I do the same thing with the "Open an existing location" option, it gives me the same error, except afterwards the Bazaar GUI hangs with "Not Responding" and needs to be killed.
Either way nothing is created that I can then interact with in Bazaar. If I create a local project and then push, it all seems to work. However, if I try to commit changes so I can push them I get an error "Bazaar has encountered an environmental error. Please report a bug if this is not the result of a local problem at https://bugs.launchpad.net/qbzr/+filebug including this traceback, and a description of what you were doing when the error occurred." the show details says "bzr: ERROR: Unable to determine your name.
Please, set your name with the 'whoami' command.
E.g. bzr whoami "Your Name ""
Before you can commit revisions, you need to set a name and email address. These are important metadata in a commit. You can set these in the Settings | Configuration | User Configuration menu. On the General tab enter the Name and E-mail fields. It's recommended to use real data in public projects, so that others who view your project can contact you in case they have questions. But it doesn't have to be real. This is a one-time initial setup.
As a next step, I would do a test to make sure you can really use your server over FTP, as a sanity check:
Commit a few revisions in your local repository, just so that you have something to push. It could be anything, doesn't matter.
Try a push to a URL in the format: ftp://user:pass#server/absolute/path/to/somewhere. In the example in your post you wrote ftp://user:pass#server, but it's important to have an absolute path there, like in this example.
If for some reason the push doesn't work well using the GUI, try it on the command line, for example:
bzr push ftp://user:pass#server/absolute/path/to/somewhere
This should really give an error message we can debug. In that case, paste the output into your question.
UPDATE
You said in comments that something was wrong with your name+email setting, and changing that resolved the problem. It would be nice to know what exactly was the problem there.
About bzr push to an FTP server, I double checked, this will never create the files on the server. From bzr push -h:
The target branch will not have its working tree populated because this
is both expensive, and is not supported on remote file systems.
Some smart servers or protocols may put the working tree in place in the future.
Over FTP it's a "dumb" server, so it definitely won't put the files there, only the .bzr directory, which is the repository and branch data. If you want to have the files there, I'm afraid you have to copy manually. There is a related bzr-push-and-update plugin, but it requires ssh access, which is not your case.

Resources