I recently upgraded to Android Studio 2.2.2. I have several commits in BitBucket, but I want to pull a specific commit into a new Android Studio project.
I understand there is a BitBucket plugin, however I do not see any way to install the plugin in Android Studio 2.2.2. I also know that there are 2 methods of cloning in Git: SSH and HTTPS. Not sure which one to use or what the best method of pulling a specific commit would be. Any help would be appreciated!
I can't help you with Android Studio and Bitbucket plugin, but the following information may be useful for you.
SSH or HTTPS. I recommend to use SSH method, in this case you should never enter your password for connect with Bitbucket server. See https://stackoverflow.com/a/40632487/637589
After you've cloned the repository you have master as a current branch. If you want just review all files in specific commit use this command line:
git checkout <your-commit-SHA1>
If want to work (change, commit and so on) basing on this commit - you need to create a new branch:
git checkout <your-commit-SHA1> -b <name-of-new-branch>
I believe you can do the same things using any git plugin to Android Studio
There is nothing special about BitBucket. It's a regular git repository. I don't think you need a plugin.
First, setup your project with git (there are many tutorials on the internet). The way I do it:
Create new repository on BitBucket
open command line and go to the path where you want your new project
type git clone {git url} (you can find it in BitBucket under Overview: git#bitbucket.org:../...git)
open this newly created folder in Android Studio
If you want to checkout a specific commit you can do it in the command line:
git checkout <commit-SHA1>
Or you can do it in Android Studio. Click on the Version Control and you'll see all the commits:
Right-click on your specific commit and select Checkout revision.
Related
I am working on an Android Studio project and I would like to add a getup repository to the current project. I am using a Mac.
I have downloaded the Github repository and unzipped the folder and was able to create a NEW project using the GitHub repository in Android Studio, but I do not know how to either
A) merge the two projects in Android Studio so my initial project can use the new GitHub Repository Project.
or
B) if I did this process incorrectly and I need to add the GitHub repository directly to my initial Project. I just don't know how and I have looked everywhere for the answer. Any assistance would be fantastic.
I found this answer about merging projects, but I do not know where to find my projects "module root"
You may refer to these 2 links, 1 and 2 for elaborations.
First of all, open the project you want to push in Android Studio.
Click VCS -> Enable version Control Integration -> Git
There doesn't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project and do git remote add
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.
If you are getting the error: fatal: remote already exists that means you already added it. To see your remotes do git remote -v and git remote rm to remove.
You may also refer to here and here for more understanding.
I create a new repository in bitbucket and create new android project want to add in a new repository but whenever I do the old android bitbucket project added to new repository along with the new Android project, I want only one project with one repository, I tried all nothing is working, I have also changed URL from git bash but whenever I add, commit and push project from android studio, it shows old project hierarchy in push window and it pushes to new repository. I don't want to add an old project with a new repository. I tried many command rehead,rebash etc etc..any help will be appreciated
From the comments:
Parent directory has common git directory
That's the problem. You need to create your new project in a directory that does not already have a .git directory. This .git directory stores all of the information for a repository. Each repo must have an independent .git directory. So create a new Android Studio project in a different folder. Then cd to that directory and run git init from the command line.
I have encountered a similar problem and found that the best solution is as follows:
1-Create the repo on the bitbucket.
2-Upload your android project to bitbucket using git extensions (very nice program to dealing with any git host).
3-Now open the project using android studio and it will be automatically set with the VCS
and now you could easily push and pull and do any git stuff from inside android studio
This may help with Bitbucket. If you create a new repository that includes any templates, it may be problematic in Android Studio if you're less familiar with git. Be sure to select "No" for option "Include a README?". Here's what it looks like at the time of this post:
I was given a ssh link to a bitbucket repo so I can work on the project. The link someone gave me was something like ssh://git#bitbucket.CompanyName.tools/sp/company-project.git.
How would I create an android studio project, linked to this repo, to work on this project and view the files? I have never worked with git so this is all new.
I do not see the repo in my main bitbucket account if it makes any difference or not
Create clone of the given repo by entering below command in your terminal :
git clone ssh://git#bitbucket.CompanyName.tools/sp/company-project.git
After cloning checkout to new branch by :
git checkout -b newBranchName
Last step, go in your Android Studio, and Import the folder where you have clone the given repo.
In Android Studio go to:
File->New->Project from Version Control->Git
then in the dialog enter the link provided in your question ssh://git#bitbucket.CompanyName.tools/sp/company-project.git
File>New>Project From Version Control>Git is what you need
So I have an Android Studio project that I have on Bitbucket that I'm having trouble moving to Github. So far I've imported the project to Github using its import feature and changed the origin using "git remote set-url". Now every time I try to push & commit using Android Studio I get the error "fatal: Could not read from repository". Also I don't know if it has anything to do with the problem but I have tried to change the SSH executable from built-in to native.
Edit: To clarify, the problem I'm having is committing and pushing using Android Studio. Everything works fine if I use git commands but when I use the Android Studio interface the "fatal: Could not read from repository" error pops up.
I suggest creating separate remotes rather than changing the URL for origin. For example, you can do
git remote add bitbucket <URL for BitBucket repo>
git remote add github <URL for GitHub Repo>
Now you can pull and push from each remote as you wish. For example
git checkout master
git pull bitbucket master
git push github master
How do I take my existing project in Eclipse on Windows for Android and put it inside a branch on a repository for Git? I also want to share this repository with my friend to help code. He already set up a Git repository and sent me the address and credentials. I just don't know how to go about this?
Once I get a cmd line for Git on Windows what do I have to do to add/clone this project to my friends repo or my own (then how do I share my repo with him?). I use Git with GitHub in Ubuntu (I didn't set it up) but I don't really know how to set this up.
I've already installed a plug-in egit and have had issues with that. I would like to use a separate interface from Eclipse for Git now.
Bones of the Question: How do I get my existing Android project into a Git repository that IS NOT a plug in to Eclipse?
Download msysgit from http://code.google.com/p/msysgit/
Download TortiseGit https://tortoisegit.org/. If you're using private keys, make sure you select Plink instead of openssh. I've had problems with OpenSSH for Windows.
Add your private key, if you're using it, to Pageant (included with Tortise Git).
Clone your repository with Tortise Git.
Copy all your files into the new directory.
In the Tortise Git context menu, select Add.
Select All
Commit
Push
That would be the short instructions.
Also, if you're comfortable with the command line tools, msysgit includes Git Bash, which is kinda like using Git in Linux.
http://nathanj.github.com/gitguide/tour.html this is a nice tutorial on a gui version of git. in your case you would do a git clone from the existing url that your project is stored in or create a new repository if you havent set one up on github yet.