I can't share my project on Github from Android Studio - android-studio

I'm getting this issue trying to share my project on github, it says that my credentials are bad but I can't even input my credentials.
I previously shared a project on github with Android studio and it worked fine, but then I deleted the project and the repository on github, and since then I have been facing this problem.

You should edit/reset your GitHub credentials in Android Studio: that way, you can enter your login information again.
Make sure to use as password a PAT (Personal Access Token)
either a classic one if you do not want said token to expire
or a fine-grained one if you want to limit its access to a specific repository, and have an expiration date.

Related

Deployment to Azure web app display Error: fatal: Authentication failed for 'https://xxx.scm.azurewebsites.net:443/xxx.git/' [duplicate]

I'm trying to clone my webapp in Azure.
When I run git clone https://username#appname.scm.azurewebsites.net:443/appname.git the terminal asks me for my password.
But when I fill in my password, it keeps saying that the authentication has failed.
Even though I changed my password plenty of times in the Portal (Settings -> Set deployment credentials).
Any reason it keeps saying that my authentication has failed?
Yes many of the answers here are pointing to the correct path, but my case:- I was given a url to access git repos on azure cloud for which I'm perfectly fine to access/browse the code on browser (Vs) when I'm trying to clone I've got the same issue.
So when you click on clone as shown in below image, you've got to Generate Git credentials; this is weird, not sure why, probably they've setup my account to access azure cloud, which can't be used to clone git repos(means can't be used as git credentials). This is something different from what I've seen with AWS/gitlab/bitbucket, maybe an issue with account setup, or if it's common thing for repos on Azure and if you're in same issue - give it a try.
Another one, as everyone has already mentioned, please don't try to connect to url which is produced over there (something looks like):
https://project-account#dev.azure.com/project-name/apps/_git/library/
Instead try to connect thru your GIT username and then use password:
https://username#dev.azure.com/project-name/apps/_git/library/
As a tip: if your username has special characters in it, Git cmd/bash will throw errors, so replace those with valid characters, ex. :-
# can be replaced with %40
+ can be replaced with %2B
something like : https://username%40xyz.com#dev.azure.com/project-name/apps/_git/library/
I had the same problem with my site and it turned out the issue is with the site url:
the automatically generated remote url was: https://user#site.scm.azurewebsites.net/site.git
On the other hand the portal showed: https://user#site.scm.azurewebsites.net:443/site.git
After updating the remote url in git with the following command:
git remote set-url azure
https://<user>#<site>.scm.azurewebsites.net/<site>.git
https://<user>#<site>.scm.azurewebsites.net:443/<site>.git
things started working as expected.
The morale of the story: check the deployment url as well as the password.
Accepted answer did not work for me but this worked.
Check your set Azure URL with
git config --get remote.<azure-remote-name>.url
Reset azure url with following command
git remote set-url <azure-remote-name>
https://<user>#<sitename>[_<slotName>].scm.azurewebsites.net:443/<site>.git
Try pushing your code using
git push <azure-remote-name>
It will open windows authentication screen which says to enter credential to connect to https://<user>#<sitename>[_<slotName>].scm.azurewebsites.net/<site>.git
Cancel this window. It will prompt the basic credential window which says to enter credential to connect to https://<user>#<sitename>[_<slotName>].scm.azurewebsites.net:433/<site>.git
Enter in your credential and it works.
Since azure does not support ssh you will have to use your password at least once (in some cases you will not be prompt for password next time)
Here is an article describe how to set it up
https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/
And here is how to set up git with Azure:
http://weblogs.asp.net/shijuvarghese/building-and-deploying-windows-azure-web-sites-using-git-and-github-for-windows
Here are the steps that you followed
If this is your first time setting up a repository in Azure, you need to create login credentials for it.
You will use them to log into the Azure repository and push changes from your local Git repository. From your web app's blade, click Settings > Deployment credentials, then configure your deployment username and password.
When you're done, click OK.
Now do this:
I had the same problem when try to git clone https://<username>#praat.scm.azurewebsites.net:443/<repo-name>.git . I solved the problem by removing the port.
So your new url should not have the port 443.
Click on Generate Credentials and then copy the password and paste it.
It works.
None of the above solution worked for me.
The reason why the same error was observed in my deployment was
because my password contained a character "#".
This malformed the Git clone url for my Azure web app. When I changed my password by removing #, it solved this issue. You can change # to %40 in your connection string as well.
Current Azure Structure for adding credential
Use the highlighted user, password, confirm password section to create an user credential. Use this to proceed where you were stuck.
Login into Azure Dev Ops portal.
Go to Project you wish to clone.
Select Repo from left menu.
Click on Clone from right top corner.
Click Generate Git Credential
Enter given username & password where you are cloning repository.
you are done!
Assuming you're entering the correct password each time, it might be a delay/propagation issue.
You can also use your Site-Level credentials as detailed on this wiki page. You can get these by downloading your publishing credentials in the Portal via the "Get Publish Profile" option on your main WebApp bar. The user name / password can then be found in the yourapp.PublishSettings file and will look something like userName="$yourapp" userPWD="ABC123". This is only mentioned as a workaround if your User-Level credentials are not working (which they should be if they are correct).
What worked for me is I created personal access token.
Click username in top right corner > Security > Select Personal Access token from left pane > New Token.
Provide token name and scope for your token and Click create.
Save that token and use it as password.
I had a similar problem where the automatically generated git clone url was:
https://group-admin-account-username#dev.azure.com/site.git
So instead I had to replace this with my own account username
https://my-username#dev.azure.com/site.git
This then prompted me for the password for my account correctly:
git clone https://my-username#dev.azure.com/site.git
I had to do it this way
Generate Git Credentials
git remote add origin https://username:password#dev.azure.com/xxx/_git/xxx
git add.
git commit -m init
push -u origin --all
I got this error in Visual studio because I used the sync feature when the branch hadn't been created in 'https://dev.azure.com/foo/bar' yet.
Instead of doing a sync, I did a push & then it prompted me for my credentials. After that it worked fine.
Hopefully this helps someone.
Adding token before dev.azure in URL settings worked for me. I am using SourceTree.
https://token#dev.azure.com/org/_git/repo
A straight forward method to get this over with is to Download/Get Publish profile (make sure you refresh the portal page) from main toolbar and use the password given in the .publishsettings file.
For me it was a matter of cloning the project with the remote url and cancelling the windows security prompt. Afterwards, it'll ask you for the password.
Once you're able to clone it, you can push it successfully.
Moral of the story: Clone it first before pushing.
On mine, the password was never created when I set the deployment user from the cli. I had to go to the web app, app services, for the app, then set the deployment credentials
Go to the Security Tab >> Personal Access Tokens >> New Toke >> Give it Full Access >> Note the Access token as you will use it as your password
this may help: with my first webapp, i had to go to Deployment Center, Deployment Credentials. And then use either the App Credentials or create User Credentials. After this, delete the cached credentials on the local machine (windows: Control Panel\User Accounts\Credential Manager). run "git push webapp master:master" again, enter either of the Deployment Credentials. That worked.
In my case none of the above methods solved my issue (but they directed me to find out where I'm going wrong)
I tried both auto generated App credentials and my custom created user credentials, and every time I was getting authentication failed message.
The description on the credentials page was advising me to have the username in the following format:
<app-name>\<username>
This was why authentication failed. As soon as I put my username without the <app-name> prefix the authentication passed and everything worked smoothly.
Hope this information helps
Navigate to the Deployment Center >> Deployment Credentials, there will be application credentials for local git. Use the username and password there will work.
Using SSH instead of HTTPS worked for me after adding my SSH key
Some of the above brought me close, such as the post by #Nilay Vishwakarma but I finally found the cause of my authentication issue to be that my password contained a '$' followed by a '..u7' which I eventually noticed in powershell was highlighted yellow when I typed.
I thus assumed it could be the CLi has an issue with this character in passwords (even though it wasn't mentioned as a reserved character in this tutorial).
I re-ran the 'az webapp deployment user set --user-name [user] --password [pwd]' command with a revised password without the '$' and was able to then enter my credentials and authenticate.
Using Mac I had the same issue. Using Git Credential manager worked.
Installed GCM using brew https://github.com/microsoft/Git-Credential-Manager-Core
Connected git to remote Azure Repo
On git push, pop up requested username and password
All connected.
Don't be surprised when you see PAT (Personal Access Token) in you settings.
"Once authenticated, the credential manager creates and caches a personal access token for future connections to the repo. Git commands that connect to this account won't prompt for user credentials until the token expires. A token can be revoked through Azure Repos."
Below link should help
https://learn.microsoft.com/en-us/azure/devops/repos/git/set-up-credential-managers?view=azure-devops
If you are using Sourcetree and you tried all of the answers here and nothing works.
try cloning your project again using this url structure as source:
https://<username>:<password>#dev.azure.com/project-name/apps/_git/library/
username and password comes from the Generate Git Credentials button when you clone your branch.
If you unable to clone the projects/repos,
Check proxy settings or VPN if provided
Check repository path access
Check your access or password expiry
If you are facing login issue,
Generate PAT (Personal Access token) for respective version control system like Git, Azure etc.
If PAT fails, create alternate credentials
If this both are right and still you are unable to access then
Goto your repository click on Clone button, there you can find Generate Credentials button. Try to login with those newly generated credentials.
Check for all above options first. If you are following everything and still facing issues then try to take help from colleagues/team leader/ manager or client.
I suddenly had the same problem. It turned out to be a problem with my local station and the Internet adapter being rejected leading to not authenticated. Disabling IPV6 solved the problem for me: See https://stackoverflow.com/a/69712045/7302498
I had a same problem because of saved login info in Macbook.
I entered Key Chain Access App of Mac.
Then, I found login info under login, opened it.
I updated password with my Credential Password of Azure Repo. (Click "Generate Git Credentials")
Done! Now, I can pull my branch in SourceTree.
In my case, I had to provide the Personal Access Token (PAT) that was created when I created a new Azure Organization, instead of any password. This PAT needs to be saved by you since it will not be available later after you close the PAT screen.
I had forgotten my PAT and had to regenerate it and provide it for the Git login, for this issue to resolve.

Problems publishing a ASP.NET Core 3.1 project to azure Getting a message "Your account is at risk"

I am trying to publish a project from Visual Studio 2019 (fully updated) to azure. But when I try to login I get the message:
Your account is at risk
To help you—and only you—get back into . I verify my account by sms message and enter the old and new email address. But then again when I try to login it again wants me to verify.
At the same time, the email works when I go into Azure portal and I also managed to deply a Microsoft SQL database into Azure SQL. (Though initially I had to add the IP address in the firewall on Azure). Also I updated the location of the user to Thailand (Where I am), in case the system matches the IP address to the location.
OTher things I have in place are for example the resource group. And I also tried to create an app in Azure portal and then publish it to this, but the issue is that I can't login from Visual Studio.
Any suggestions on how I can publish a project to Azure?
------- UPDATE --------------
Still in the loop of login, verify, new password and login again. The screen I get is like this:
The following screens are:
enter code send by sms
Enter old and new password
Login
-. And back at the verify screen again.
Any suggestions.
Based on the suggestion below I also removed some of the credentials in the credential manager (those that I thought might have to do with this issue).
One possiblity is that there is an old version of your password stored in Credential Manager.
When you try to login via Visual Studio it fails because the password is incorrect. Trying to login with the incorrect password also causes the account to lock, requiring you to verify with SMS.
If this is an Azure WebApp, your best bet is to download the publish profile and use it in your Visual Studio, this way you'll be able to publish your app.

Unable to sign in windows azure account using Visual studio 2013 after changing password

I have just changed my Azure portal login password as it was about to expire in next 4 days. After this when I tried to deploy my cloud service VS 2013 ask "ReEnter Credentials your Credentials", After entering new credentials it keep asking me ReEnter your credentials also No subscription shows.
I tried to log in via Server Explorer also but the same problem occurs with Object Reference not set to an instance of an object error.
Can anyone have the solution of this?
Many thanks.
I have had this before on VS2015, the following worked for me:
Reboot and sign in (to ensure there are no processes locking relevant files)
Delete the folder %LOCALAPPDATA%.IdentityService
Go to Control Panel -> User Accounts -> Credential Manager and removing associated web and windows credentials
Delete the contents of %temp%
If that fails, try running Visual Studio as administrator and sign in again.

Why I am unable to access my forked repository using GitHub API

I have a custom application which is able to access the Enterprise repository using my Personal Access Token.
But when I forked the same enterprise repository I am unable to access it using the same application which uses the GitHub API and my personal access token.
So the enterprise repo looks like this : my-org-name/test-repo
And my forked repo looks like this: andy/test-repo
When I authenticate using personal access token and try to get the owner name for my repo like below using PHP KnpLab GitHub API SDK as below:
$this->gitHubClient
->api('repo')
->find($repoName)['repositories'][0]['owner']
It throws exception (No 400 type or access or forbidden exception). When I tried to check the 'repositories' array, the array itself is empty.
I have checked all the configuration twice, E.g API End point, Branch Name, Repo Name, etc. And everything is looking OK. It appears to be some access issue but not quite sure what I need to do to ask the Admin so that proper permission is set on my account for accessing the repo.
How should I solve this issue?
Edit: Did some further testing. I am able to access some other repos that looks like andy\another-repo. So only this specific repo I am unable to access.

Android Studio can't login to GitHub

I'm getting this issue while logging in on GitHub on Android Studio:
Can't login: Can't get user info 404: Not found
Has someone faced this issue? How can I get around this?
I have faced this problem too. Try using token to login.
Log in to github.com on the browser. Go to Settings -> Developer settings -> Personal access tokens. There you can create a new token and then, go back to Android Studio, select Enter Token at the login prompt.
I'm working on 4.1.1 Android Studio and it didn't allow me to log in with Login + Password neither.
So I succeeded generating a token from Github (Account -> Settings -> Personal access tokens - > Generate new token), but make sure before generating the token to check the "repo", "gist" and "read:org" options.
Everything's working fine from there.
Have fun coding !
I use "github.com" as host (not the whole clone url), and my github login and password and can login without any issues.
So, I know it's been 6 years now, but since I didn't find the solution that worked for me, I decided to share here.
Only step: Go to Settings > Version Control > Git > Mark "Use credential Helper" box and you're done.
Hope this helps someone, thanks.
In host you only have to put 'http://github.com'
Nothing more
you can use Token for login in android studio .
1.go to your github profile
2.click on settings
3.go to Developer settings
4.click on Personal access tokens
5.Generate new token
and copy it and paste it in above window on android studio.
For me the problem was that the repository URL was set with http:// but the credential goes to the same URL but with https://.
changing the repository URL to https:// solved my problem.
1- Go to your github page,
2- Open Settings menu and create a new token
3- Copy new token
4- Open Androdi studio goto VCS -> import into version control -> Share Project in Git Hub login
5- Use Token option
6- Paste token you created and copied
7- Click login
No need to change url
I am using Android Studio 4.1
If you can't find the access token option in Android Studio
I was simply not able to find the option to add the access token to Android Studio, as the credential was not working.
If you click on the Add Account option as shown below, you won't find the option to enter the access token (bad UI I'll say):
Add Account with no option for access token
Solution:
Click the small + icon at the bottom of the dialog box to find a menu > choose Log In with Token to find the option.
Generate a token from Github and enter it here. It will be done!
Where to find the access token option
I faced the this issue for my private repository, So in Github I created new access token and given all access for this token. Use this token in Android studio, It worked for me
I'm done with this problem, use the token to login.
create tokens in this way;
simply checklist on
-repo
-admin:org
-gist
Ceklist Token
You can use token to solve this problem.
Login to GitHub account in browser
Go to SETTINGS-> DEVELOPER SETTINGS->PERSONAL ACCESS TOKENS
here you can create token with suitable scopes.
Remember that selecting scopes is important to access token in android studio.
After that just copy the generated token and paste in android studio.
Have a fun with coding!
I have face this same issue with both Mac and Windows. Creating a personal access token always solved this issue for me. Sign into github click on on account > setting> Developers Settings > Personal Access Tokens
Using 'https://github.com/' and my credentials, I get access
From Android Studio.
Go to Settings
Go to Github
Make sure you login in using a created Auth Token Key from Github
From Github.
Go to Preferences
Go to Developer Mode
Generate a New Token Key and give it all the rights to access Github account
Copy new Generated key into Android Access token and enter OK when done.
From Android Studio.
Go to Settings
Go to Github
Make sure you login in using a created Auth Token Key from Github
From Github website
Go to Settings
Go to Developer Settings
Generate a New Token Key
Give a alias to the Token key
Mark repo, admin:org, gist.
Click on Generate token button
Copy new Generated key into Android Access token and enter OK when done.
Follow the steps ---
Go to file >> setting >> version control >> add account
then login.
If can't login message is displaying then you have to generate the token. Go to Settings >> Developer settings >> Personal access tokens.(make sure to check fields like select all repo, select read:org(inside- admin:org), select gist).
When you paste git url use .git at the end of url.
Use SSH (forget https) (E.g., don't use https url for cloning)
Use Personal Access Token (PAT) (forget username/password)
(e.g., Settings > Developer Settings > Personal Access Token)
Update git to latest version (e.g., 2.35.1) //I think this is important
In Github, Uncheck Settings > Developer Settings > Keep my email addresses private
Conclusion: You add Personal Access token in Github. Then from any IDE (e.g., Android Studio, IntelliJ IDEA etc.) you can add remote using ssh (e.g., name: origin, URL: git#github.com:your_github_username/your_git_repo.git. That's it
If not already done,
Configure git global username and email
git config --global user.name "your_username" && git config --global user.email "your_email"
If in windows, you can add windows credentials for your user, control panel > users > manage your credential > Windows Credentials > Add a generic credential >
Internet address will be git:https://github.com and you need to type
in your username and password will be your GitHub Personal Access
Token => Click Ok and you are done
I deleted all tokens and generated new one with all access,
Now it's working...
Generating the Token as explained worked for my perfect.
Need to grant the correct permissions to such token.
server => github.com to change http://github.com
use access token no password

Resources