Trying to figure out how to force command-line git to use Github token. If I clone repository with user name and token like git clone https://<user>:<mytoken>#git.web.com/organization/repositorythen everything works fine.
When I try to clone without the user name or token then the operation fails with an error:
remote: Password authentication is not available for Git Operations.
remote: You must use a personal access token or SSH key.
I would like to store that token somewhere so that I would not have to give it to git every time. Where should I store the token?
I tried to add token variable to a [user] section in .gitconfig file but it did not work.
Tried unsetting and setting (wincred) credential helper but that did not work either.
You should enable a credential manager, such as wincred, and then when Git prompts you for the username and password, enter the username and your token as the password. Git will then tell the credential helper to save the password in the system credential store, and future operations to the same server will reuse those credentials.
This is much more secure than using the token in the URL, because the system credential store is encrypted, whereas the file containing the URL is not.
It may be the case that you already have invalid credentials saved for that remote which are causing the failure; if so, see this answer for instructions on how to remove them so Git prompts you again, and then follow the steps above.
Related
So, this is what happens even if I entered correct Github UserName (or ID) and Password.
I have tried it with, name, UserName, Email ID but it all fails.
How can I get through this authentication step? plz help!!
entered correct Github UserName (or ID) and Password.
That the point of the error message. GitHub no longer accept passwords (since Aug. 2021), only PAT (Personal Access Token)
If you enter your token as a password, it would work.
you can also check your git config --global credential.helper is set to manager the Microsoft cross-platform GCM (Git Credential Manager)).
That way, you will cache said credentials (username+token), and won't have to enter them again.
I am trying to access the Github repo which sits behind an enterprise firewall (Open VPN). I am trying to access with my username and password but getting the below Exception. Any suggestions on how to access the repo with Spring Cloud.
application.properties:
spring.cloud.config.server.git.uri=https://github.com/company-repo/abc.git
spring.cloud.config.server.git.username=tarun
spring.cloud.config.server.git.password=xxxxx
spring.cloud.config.server.git.ignore-local-ssh-settings=true
Exception:
Error occured cloning to base directory. org.eclipse.jgit.api.errors.TransportException:
https://github.com/company-repo/abc.git: not authorized
Do not Use Your GitHub password in your app.prop file...You will get a Not Authorized exception. Instead Generate an access token.
Creating a personal access token
You should create a personal access token to use in place of a password with the command line or with the API.
Personal access tokens (PATs) are an alternative to using passwords for authentication to GitHub when using the GitHub API or the command line.
If you want to use a PAT to access resources owned by an organization that uses SAML SSO, you must authorize the PAT. For more information, see "About authentication with SAML single sign-on" and "Authorizing a personal access token for use with SAML single sign-on."
As a security precaution, GitHub automatically removes personal access tokens that haven't been used in a year.
Creating a token
Verify your email address, if it hasn't been verified yet.
In the upper-right corner of any page, click your profile photo, then click Settings.
Settings icon in the user bar
In the left sidebar, click Developer settings.
In the left sidebar, click Personal access tokens.
Click Generate new token.
Give your token a descriptive name.
Select the scopes, or permissions, you'd like to grant this token. To use your token to access repositories from the command line, select repo.
Click Generate token.
Click to copy the token to your clipboard. For security reasons, after you navigate off the page, you will not be able to see the token again.
Warning: Treat your tokens like passwords and keep them secret. When working with the API, use tokens as environment variables instead of hardcoding them into your programs.
To use your token to authenticate to an organization that uses SAML SSO, authorize the token for use with a SAML single-sign-on organization.
Using a token on the command line
Once you have a token, you can enter it instead of your password when performing Git operations over HTTPS.
For example, on the command line you would enter the following:
$ git clone https://github.com/username/repo.git
Username: your_username
Password: your_token
Personal access tokens can only be used for HTTPS Git operations. If your repository uses an SSH remote URL, you will need to switch the remote from SSH to HTTPS.
If you are not prompted for your username and password, your credentials may be cached on your computer. You can update your credentials in the Keychain to replace your old password with the token.
The way i made it work is :
Generate the Access Token on Github repo and provide read and admin rights to it
Use the Token as password
Credentials can be saved in Kubernetes as Secrets or inside Vault. Hope this helps.
I'm trying to create a Spring Cloud Config Server to retrieve configuration files from a private GitHub repository. My GitHub account has 2 Factor Authentication activated so I wasn't expecting the below configuration to work, which it didn't but I can't find any documentation to suggest what I need to do in order to make it work.
What configuration do I need to set that will allow the connection to work?
spring.cloud.config.server.git.uri=https://github.com/DanBonehill/photo-app-config
spring.cloud.config.server.git.username=USERNAME
spring.cloud.config.server.git.password=PASSWORD
Error
org.eclipse.jgit.api.errors.TransportException: https://github.com/DanBonehill/photo-app-config: not authorized
What you could try and do (have not tested this), is create a personal access token from the Github console.
Then configure
spring.cloud.config.server.git.username=<yourusername>
spring.cloud.config.server.git.password=<yourtoken>
Instead of using username and password you should use an ssh key, the official documentation can guide you through it!
Basic authentication using a password to Git is deprecated and will soon no longer work. Visit https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information around suggested workarounds and removal dates.
you solve this in 2 minutes, this problem is because at August 13, 2021 the github update the login form, to solve this.
1) login in your gitHub folow this path: Settings > Developer settings > Personal access tokens > Generate new token
2) Now set a long time to expiration token, check the "repo" to allow access repository with this token, and Generate token.
3) Now skill your github password because this token created is your new password, replace this at all application, server, terminal that need to access github.
4) Now configure your spring configuration server, this is a content of file "application.properties" of spring configuration server at path /src/main/resources/application.properties.
spring.cloud.config.server.git.uri= https://github.com/"username"/"repository" //your githur repository
spring.cloud.config.server.git.search-paths= myFilesFolder /if your files is into some folder
spring.cloud.config.server.git.username= testUsername // your username
spring.cloud.config.server.git.password= gti_FdsweecSoUSHPsdfw //Here is your new token created
When I try to push/pull with Gitkrakent to/from Heroku, GitKraken tells me :
"Please log in to continue"
What is the requested "user/login" ?
(The one from my personal Heroku account doesn't work").
Thanks a lot !
Your username is the email you used to login on heroku.
The password is your auth token. You can get this by running these in console:
heroku login To login
heroku auth:token To get your password for GitKraken
To use Heroku git (something like https://git.heroku.com/reponame.git) with GitKraken, please use email as username, and use authorization token as password.
I create a long-term password to use with GitKraken by
Go to Heroku UI then login
Account Settings
Applications
Authorization / Create
authorization (don't set expire if you want long-term access)
Pointing remote to ssh protocol solved this for me.
https://git.heroku.com/{your-app}.git => git#heroku.com:{your-app}.git
Make sure you have same updated ssh keys in your account settings in Heroku related to that repository.
You may use ssh-agent to handle many keys
Initially Cruisecontrol was running perfectly. We had changed from stash to github url. Upon changing we always endup with error 'CheckForModifications'. Not sure whether the credentails/url has been cached.
Error Message:
Source control operation failed: fatal: remote error: CAPTCHA required. Your stash account has been marked as requiring a CAPTCHA to be solved before you may login agin. This is typically caused by too many attempts to login with an incorrect password. The required CAPTCHA prevents your SCM client from accessing Stash until it is solved, even if you enter your password correctly.
It sounds like it is still trying to access Stash. to change the remote url, go to your working directory and use
git remote set-url origin https://github.com/user/repo.git