Git working in bash but not in Android Studio - android

I've recently encountered an issue with Git in Android Studio.
I have some projects in Android Studio, taken from a git repository (managed with Gitlab). Until some days, actions like Push & clone worked perfectly, but not anymore...
I can still push & pull from the Git bash, but not in Android Studio.
It give me the following log :
Git Pull Failed
fatal : Could not read from remote repository
The test button under Settings->Version Control->Git work, I've reintall the last version (2.6.4) and it show me the correct version..
I've try generate a new SSH key, import a project cloned with the bash... But nothing work..
Any clue of the problem ?
Thanks in advance

Ok, I've found the solution :
It was because since some days ago, I use Android Studio in Administrator mode, but my SSH key was in my user profile.
As I was using Git in Bash mode with my profile, it was ok. But Android Studio was looking for the .ssh in the Administrator profile, wich doesn't exist..
I use Android Studio with my profile again, and it work again

Related

Issue with using Git Push in Android Studio Chipmunk 2021.2.1 on Mac M1 "Invocation failed Unexpected end of file from server" [duplicate]

I am trying to push my code to my bit bucket repository but from last few days after update from bit bucket, I have to use token to push code. But I don't know where to add token.
Could anyone let me know the entire process for android studio. I have also gone through with This documentation
.But didn't get any idea about how to use it in android studio.
As for me I use android studio, I came across the same issue; where I was unable to make push command to my github repo, that is after an update of my IDE version to chipmunk.
Solution that worked for me:
Enable the Credential helper - In the IDE select File -> Settings -> Version Control -> Git -> Mark the check box for use Credential helper. Then apply changes.
Invalidate and clear caches - In the IDE select File -> Invalidate caches.
after several hours of research I found the best soultion for this I dont know this is the right way to use it or not. But its working fine.refer this answer...Refer this
git config --global --unset credential.helper
and then git pull from terminal
git pull
then will ask your username and password
You may try with below flow, If you are using android studio in Windows :
File -> Settings -> Version Control -> Git / Check "User credential Helper"
It's working for me.
Simply update your git version :
git update-git-for-windows
I also encounter this problem, I am using mac and I solved it by
cmd + space
type keychain access
search github
delete the keychains found
delete github on my android studio (android studio -> preferences -> version control -> Github)
re add github on my android studio using new personal access token
Hope this help, Thanks
I just had the same error. I downloaded the project again and tried again, it gave an error. Then I updated the token in my GitHub account then I turned Android Studio on and off and it worked for me.
Interesting case of PyCharm update:
OS: Ubuntu 18.04
In my case the PyCharm got updated and the existing open project was using older version.
Solution : Just closed the existing older PyCharm and open the project in newer version
For Bitbucket
create your "app password" on bitbucket console. Under your Avatar ->Personal Settings ->Access Management ->App Password.
Once done, copy app password and push from the terminal enter -
git remote set-url origin https://<Your_Account_Name>:<App_Password>#bitbucket.org/<Your_Account_Name>/<Repo_Name>.git
For Github
create a new GitHub token,
Once done copy token and push your project from the terminal :
git push
you'd be asked to input your username
Username for 'https://github.com': use actual GitHub username not email
Then you'd be asked to enter your password
Password for 'https://"username"#github.com': this is where you paste the token you just created
commit will be pushed after this

error: unable to read askpass response from '/home/.cache/Google/AndroidStudio2021.1/tmp/intellij-git-askpass-local.sh' in ubuntu android studiio

I am trying to push my code to my bit bucket repository but from last few days after update from bit bucket, I have to use token to push code. But I don't know where to add token.
Could anyone let me know the entire process for android studio. I have also gone through with This documentation
.But didn't get any idea about how to use it in android studio.
As for me I use android studio, I came across the same issue; where I was unable to make push command to my github repo, that is after an update of my IDE version to chipmunk.
Solution that worked for me:
Enable the Credential helper - In the IDE select File -> Settings -> Version Control -> Git -> Mark the check box for use Credential helper. Then apply changes.
Invalidate and clear caches - In the IDE select File -> Invalidate caches.
after several hours of research I found the best soultion for this I dont know this is the right way to use it or not. But its working fine.refer this answer...Refer this
git config --global --unset credential.helper
and then git pull from terminal
git pull
then will ask your username and password
You may try with below flow, If you are using android studio in Windows :
File -> Settings -> Version Control -> Git / Check "User credential Helper"
It's working for me.
Simply update your git version :
git update-git-for-windows
I also encounter this problem, I am using mac and I solved it by
cmd + space
type keychain access
search github
delete the keychains found
delete github on my android studio (android studio -> preferences -> version control -> Github)
re add github on my android studio using new personal access token
Hope this help, Thanks
I just had the same error. I downloaded the project again and tried again, it gave an error. Then I updated the token in my GitHub account then I turned Android Studio on and off and it worked for me.
Interesting case of PyCharm update:
OS: Ubuntu 18.04
In my case the PyCharm got updated and the existing open project was using older version.
Solution : Just closed the existing older PyCharm and open the project in newer version
For Bitbucket
create your "app password" on bitbucket console. Under your Avatar ->Personal Settings ->Access Management ->App Password.
Once done, copy app password and push from the terminal enter -
git remote set-url origin https://<Your_Account_Name>:<App_Password>#bitbucket.org/<Your_Account_Name>/<Repo_Name>.git
For Github
create a new GitHub token,
Once done copy token and push your project from the terminal :
git push
you'd be asked to input your username
Username for 'https://github.com': use actual GitHub username not email
Then you'd be asked to enter your password
Password for 'https://"username"#github.com': this is where you paste the token you just created
commit will be pushed after this

Changing gitlab account in android studio

Hello does anyone know how can I change my git lab account in android studio I started a project on my git lab and I want to move it in the new work account I searched but I can't find anything. I reinstalled android studio but when I try to do push or commit it goes to the old account.
Assuming that you are talking about the GitLab user account, you can change it by manually editing the .git/config file.
Git actions like Pushing and Committing are not done by Android Studio, but by Git. So change the config.
Open the file below in a text editor,
<android_project_path>/.git/config
then add/change the lines below,
[user]
email = your#email.address

Cant pull/push git from Android studio 4.0 canary

Each time I attempt to pull a repo from bit bucket, I keep getting the error
Failed to start Git process User Authentication Token not found
I have tried resetting the windows credential, uninstalling and reinstalling both git and Android Studio, as I think there is a compatibility issue with Android studio 4.0 and my pc which uses windows 10.
Any ideas?
The following helped me:
From the directory of the previous version C:\Users\(Your user)\.AndroidStudio3.(version)\config(I checked on 3.5 and 3.6 versions) copy the user.token file.
Paste it into C:\Users\(Your user)\.AndroidStudioPreview4.0\config
Launch any git operation requiring authorization (push/pull), in the window that appears, enter your authorization data.
Here's the workaround from Google's issue.
Close the IDE.
Remove settings for Android Studio 4.0 or copy them somewhere else.
Install 3.6 RC 1.
Run it and perform any Git operation in the IDE.
Close 3.6 and open 4.0 again importing settings from the previous version.
You are not alone with it.
Have the same issue on Linux (Android Studio 4.0 Canary 5).
I could not "Enable Version Control Integration" in the new project.
I tried to login on GitHub in settings (Version Control -> GitHub), I put my token and then seen the success... but when I closed the settings window and reopen it I seen the message "Missing access token".
EDIT: 2019-12-21
I want to make you happy.
I found the page with previous versions of Android Studio.
Git works in Android Studio 4.0 Canary 4, just remove your version and download it on the link below.
https://developer.android.com/studio/archive
If you've created two-factor authentication, you can't log in like this, so try something like this:
git remote -v
git remote remove origin
git remote add origin git#github.com:user/repo.git
visit here to get token: https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line

Bitbucket plugin can't connect in Android Studio

I recently downloaded the Bitbucket plugin for Android Studio (I'm running 1.1.0). Initially, I downloaded it from this link (https://plugins.jetbrains.com/plugin/6207?pr=phpStorm) which should be compatible with Android studio.
When I tried to clone a project in my repo, it prompted me for login credentials. I entered them, but it tells me that I can't connect to bitbucket. Then I installed the plugin from the plugin settings page seen here
I made sure that the plugin was enabled. I'm thinking this is an issue that has to do with proxy settings (I'm currently on my college campuses network, but I can connect to other VCS services like Git without problems so I doubt that's the problem).
Any suggestions?
EDIT:
Going into Bitbucket's settings and testing it shows this:
Had the same problem some time ago. Though I have not yet upgraded to 1.1, I found this implementation to work with previous version:
https://bitbucket.org/dmitry_cherkas/jetbrains-bitbucket-connector/downloads
It seems the "official" one is outdated and this one is working fine.
Please, let me know if this does work for you.
Regards
Jose
you don't really need bitbucket plugin.
Push your project to bitbucket
create a new repo in bitbucket
click on "I have an existing project" in bitbucket repo
execute these commands in Android studio Terminal to push your project to bitbucket
Checkout from Bitbucket
you can also checkout bitbucket projects giving bitbucket URL in "Checkout from GitHub" option in Android Studio
If you are still having problems (like I was recently) even though you've tried the plugin and you feel uncomfortable or not knowledgeable about initializing git for your project by hand via terminal you can use SourceTree. You will have no problems with BitBucket using source tree since both are made by Atlassian.
Once you've installed SourceTree and walked through the first boot setup process giving SourceTree your credentials you click Clone/New and a dialog will pop up. There will be the normal browse button and also a button button that looks like a globe allowing you to browse the hosted projects linked to your BitBucket account. You can also copy an paste the link from the project home on bitbucket as well. Once you've chosen the repo you want to clone, pick the destination folder and if you want to bookmark the project or not and press "clone".
Once clowning is complete you should hit the pull button to pull down the latest changes picking the appropriate branch you want to pull from. When pulling is complete you should have all the files that's on the head of that branch (master if not specified) which in most cases is an android project.
Open Android Studio and choose File->Open and browse to the folder you just pulled data to and that open the android project. Once that is done and the project is open make sure you go to VCS and you should not see "Enable Version Control Integration". If you see this that means android studio does not see the .git folder hidden in the project root (or something in that ball park....maybe it's really not in the project root). If you see git commit and git pull options then you are now using version control and bitbucket as your remote repo. Make a change to a file and you should see it turn blue specifying that changes have been made but not committed.
For more info on version control in android studio see this video https://youtu.be/Ldmc757EXaE?t=6m47s and the documentation on the intellij website.

Categories

Resources