Converted to Gradle, How to Create Branch on Existing Git Repository? - android

I have used Android Studio to convert my existing project to Gradle.
These are the steps I took:
Connected Android Studio to my Git repository
Pulled the Git Repository into Android Studio into directory git-project
File > Import Project
Selected the project I had just pulled
Now I have a new directory named gradle-project
I want to add gradle-project as a new branch to my existing Git repository. When I open the gradle-project, I can create a new branch and commit to my local repository. If I try to push to my remote repository, it says "no remotes are defined".
Is it possible for me to add this as a new branch to my exiting remote repository?

you must add the remote. Try to write in console: git remote add origin git://github.com/username/test.git
Here is the link https://help.github.com/articles/adding-a-remote

Related

How to export an Android Studio project to a new GitHub branch in a specific Repository?

I have some code I want to add to a new branch in an existing repository. I tried to 'share project to GitHub' under VCS, but it just makes a new repository in a master branch with my code. Is there an option to commit the code to a new branch in an existing repository through Android Studio? I even tried uploading all the files to a new branch on Github.com directly but too many files for that to be processed.
git checkout -b 'new-branch-name' sentence creates a new branch and then you just commit the changes there

Can't push an android studio project into github

I had some existing repositories on github and i deleted them, now i want to reshare my project into github the android studio but i get this error
JustJava2: failed with error: fatal: repository not found
How can i make android studio to create a new repository and push the project their?
First, please check the github repo URL in android studio.
Android studio -> click Terminal -> input the command git remote –v to check the github repo URL you were working.
Assume the URL you found is https://github.com/username/r2 (or https://github.com/username/r2.git).
Then create a new repo with the same name (such as r2).
Click + icon -> New repository -> name the same repo name (r2) as you found in above step -> Create repository.
If you have already create a new repo with different name or there is no output for git remote –v in the first step, you can set remote url in android studio terminal by git remote set-url origin <the new created repo URL>.
Now you can push your project successful in android studio.
Have you created a new remote repository and updated the local repos remote url? You can see how to change the remote url from the command line here

Change bitbucket repository name on local project

Im using Android Studio with bitbucket. I changed the name of a repository and now when I try to push, I get the message Fatal error, repository not found.
How do I update the new repository name on my Android Studio Project to push correctly?
Thanks in advance.
See my example:
Go to terminal,
cd projectFolder
git remote -v (it will show previous git url)
git remote set-url origin https://username#bitbucket.org/username/newName.git
git remote -v (double check, it will show new git url)
git push (do whatever you want.)
See my example:
I simple changed the repository name accessing the config file inside the .git folder of my project. That solved the problem.
Update your git remote, changing the repo url: https://help.github.com/articles/renaming-a-remote/

How to delete a repository and add a new one in Android studio?

I was working with VCS enabled in Android Studio and pushed my code to a repository that I had created in BitBucket. However, now the team I'm working with has created a new repository also on BitBucket and I have to switch my entire project there. So how do I stop VCS in my current project, and push code to a new repoositroy with a new link from scratch?
Also, in the first repository that I was working with only the "java" folder was pushed and not the rest. Now in the new repository I want to be able to commit and push changes made in all other files as well like "res" etc.
U can remove connection from git repository.
step 1 :Open git bash.
step 2 : navigate to the master folder. '
step 3 : $ git remote rm origin
The git remote will now be removed from the repository.
Now u can add new connection by using VCS->Git->+add.
[Remove and add git]
or you can add/edit remote url
VCS -> Git -> Remotes...

How to add an already existing branch in an already existing Android Repository on Eclipse

So I have imported an Android project using the Git import. When I imported it I added all of the Remote branches. But since then some other branches have been added to the project. I am trying to add a branch that was added using GitHub into my Eclipse Git Repository-> Branches->Remote Tracking. How can I do this?
So what solved the issue was:
On Project in Git Repositories View:
rightClick Remote->Fetch
On Branches
rightClick Switch To -> New Branch. . .
Source: Select [Branch of interest]
Branch name: [same as remote branch name, this is the local branch name]
click Configure upstream for push and pull
click Rebase commits of local branch onto upstream
click Checkout new branch
Finish
As mentioned in the Egit manual, "Remote tracking branches are created automatically when cloning and fetching from remote repositories."
So after your fetch, you can click on the create Branch icon and create a new local branch based on origin/newReoteBranch name.

Categories

Resources