Android Studio Gitlab migration - android

I am attempting to migrate a local project to a currently existing empty Gitlab project repo. I have added via the git shell the project's remote origin. I have also enabled git as the VCS in my AS project. I have committed changes from my project, via AS, however no files are showing in my Gitlab webclient.
Has anyone experienced this issue before?

So you say you have an empty Gitlab project.
Then you said that you have:
Added remote origin, via shell (git remote add origin https:/ /gitlab.com/user/repo.git, right?)
Enabled git as the VCS in your Android Studio project (VCS -> Enable Version Control Integration, and then selected Git from the Select a version control system to associate with the project root:, right?)
Commited changes to your project, via Android Studio (VCS -> Git -> Commit Directory, right?)
That is all ok, you are only missing a push to the remote, git push -u <remote> from the command line, or VCS -> Git -> Push from Android Studio.
If you are using Gitlab then Android Studio Gitlab Projects plugin will be very useful to you. Check it out from Android Studio in File -> Settings, then Plugins, then Browse Repositories...
tl;dr
Given the steps you have already done, I would say you are only missing a push to the remote, as #Darren said, git push -u <remote>. Now, if you want to manage everything from Android Studio, install Gitlab Projects plugin.

Related

How do I download a GitHub repository to an Andriod Studio project that I am currently working on?

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.

How to copy Android Studio project to remote Git (NOT GitHub) server

I can't find instructions for how to copy an Android Studio project from my Mac to a remote Git (NOT GitHub) server.
This doesn't seem like it should be hard but I have searched for hours and can't find anything specific.
A step-by-step guide would be wonderful.
The steps below works for any Jetbrains based platforms like Intellij IDEA, Android studio, PHPStorm, etc. It also works for any git platform (including GitHub)
You can use the following steps to push your code to a remote Git repository:
Goto VCS in the menu bar.
select "Enable version control integration."
choose "Git"(not GitHub) and press ok.
Then you can see a Version control tab near android monitor.
Open version control tab, go to local changes, and add all unversioned files to VCS. (Either right click on unversioned files and click add all, or click browse, select all, and click plus sign to add all to VCS)
Commit changes (Ctrl+K)
Push changes. (Ctrl+Shift+K)
define remote URL
enter username and password.
click on push.
To copy android studio project to a remote repo, you just need to follow below few steps (for your situation):
If the android project already managed in a local git repo
In Android studio Terminal windows, use below commands:
git remote add upstream <URL for the remote repo> -f
git push upstream master
If the android project is not manage in git repo for now, you can use below steps:
In the root directory of your project, execute the following commands,
git init
git remote add origin <URL for the remote repo> -f
touch .gitignore
#Add the (pattern of) files you do not want to traced by git, as https://github.com/github/gitignore/blob/master/Android.gitignore
git add .
git commit -m 'add .gitignore'
git push origin master
Note: If the remote git repo is not empty, you can clone the remote repo locally and then copy your project in it. Then commit and push.

Add an Android Studio / IntelliJ project to a code.google.com project with git

So, I have an Android Studio (IntelliJ) project for an app I'm writing. I'd like to add it to a project I've created on code.google.com. How do I do that without having to clone the repository to a new project directory and then push all my AS project files into it?
I see that I can almost do this with VCS > Checkout from Version Control > Git and specify a Git repository URL, but AS forces me to create a new, empty directory when I do this.
How do I setup Git source control with code.google.com as my remote repository, without having to move my existing project files around in the file system?
OK, so the best solution I've come up with is to create a local git repository, create a code.google.com git project, and then manually connect the local repository to the code.google.com project. Note that this requires git to be installed on your development machine.
Create the app project in Android Studio.
Select the root project folder.
Select VCS > Import into Version Control > Create Git Repository
Select project folder to create a git repository.
Now the project is under source control.
Create a project at code.google.com using git source control.
Go to the Source > Checkout page of the project and get the clone URL.
Open a terminal and navigate to the project directory.
Modify the local git repository to connect the remote repository on code.google.com:
git remote add origin https://my-user-name%40code.google.com/p/my-project-name/
Add files to the repository and commit them using the Android Studio interface or the git command-line interface, e.g.;
git add files-for-source-control.ext
git commit .
Finally, push the commit to the remote server:
git push origin master
#ObAt,
If you find Nothing to push message on Android studio, Try this method
Got to
VCS > Git > Push
and Select the tick box for "Push Current Branch to Alternative branch" and click Push button

How do you synchronise projects to GitHub with Android Studio?

I am trying to synchronise a project that I have on in my Android Studio folder to GitHub, but I am not fully sure what to do other than adding my credentials in the options menu. Could someone give me a quick guide, please?
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 <remote_name> <remote_url>
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 <remote_name> already exists that means you already added it. To see your remotes do git remote -v and git remote rm <remote_name> to remove.
See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html
http://gitref.org/remotes/
Following method is a generic way of pushing an Android Studio project to a GIT based repository solely using GUI.This has been tested with a GIT repository hosted in Visual Studio Online and should virtually work with GitHub or any other GIT based version control provider.
Note: If you are using GitHub 'Share on GitHub' is the easiest option as stated in other answers.
Enable the GIT Integration plugin
File (main menu) >> Settings >> Search for GitHub Integration
Enable Version Control Integration for The Project
VCS (main menu) >> Enable Version Control Integration >> Select GIT
Add project file to Local repository
Right Click on project >> GIT >> Add
Commit Added Files
Open the Version Control windows (Next to terminal window) >> Click commit
button
In the prompt window select "commit and push"
Defining Remote
After analyzing code android studio will prompt to review or commit code
when committed will be prompt to define the remote repository.There you can
add the url to GIT repository.
Then enter the credentials for the repository and click 'Ok'.(Visual Studio
online Users need to enable "alternate authentication credentials" as
mentioned here to login to repository)
On Android Studio 1.0.2 you only need to go
VCS-> Import into Version control -> Share Project on GitHub.
Pop up will appear asking for the repo name.
In the version of Android Studio I have (0.3.2), it was as easy as using the menu.
VCS Menu > Git > Share on GitHub.
It will then ask you for your credentials, and then a name for your new repo, and that's it!
This isn't specific to Android Studio, but a generic behaviour with Intellij's IDEA.
Go to: Preferences > Version Control > GitHub
Also note that you don't need the github integration: the standard git functions should be enough (VCS > Git, Tool Windows > Changes)
Android Studio 3.0
I love how easy this is in Android Studio.
1. Enter your GitHub login info
In Android Studio go to File > Settings > Version Control > GitHub. Then enter your GitHub username and password. (You only have to do this step once. For future projects you can skip it.)
2. Share your project
With your Android Studio project open, go to VCS > Import into Version Control > Share Project on GitHub.
Then click Share and OK.
That's all!
For Android Studio 0.8.9: VCS --> Import into version contraol --> Share project on Github. It doesn't give you option to share in a specific repository or at least I couldn't find (my limitation!).
You can add your github info here: File --> Settings --> Version COntraol --> Github.
Now you can do it like so (you do not need to go to github or open new directory from git):
First time I have added a video link for solving your problem but I learned it was a bad idea. This time I'll explain it briefly.
Android studio is compatible with github but you need adjust something:
Setup Android Studio
Setup the Github plugins in the Android Studio settings
Android Studio settings >> Plugins page
Download the git version control system from this link and setup
https://git-scm.com/
After the installation, open Android Studio settings page and select the git.exe
settings >> version control >> git
Usually the path to git.exe is program files >> git >> bin >> git.exe
Go to Settings >> Version control >> Github you will see login and password for your Github account. Apply the settings.
For updating the project, go in Android Studio top line click
VCS >> enable version control integration >> git
One more time
VCS >> import into version control >> share project on Github
and enter your master password.
Now you can use VCS update buttons for updating your project to Github
For existing project end existing repository with files:
git init
git remote add origin <.git>
git checkout -b master
git branch --set-upstream-to=origin/master master
git pull --allow-unrelated-histories
In Android Studio 0.8.2 , you have the same option (ie Share on GitHub). If you want to find it, you can use ctrl+shift+a and enter github in the input text.
Github with android studio
/*For New - Run these command in terminal*/
echo "# Your Repository" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/username/repository.git
git push -u origin master
/*For Exist - Run these command in terminal*/
git remote add origin https://github.com/username/repository.git
git push -u origin master
//git push -f origin master
//git push origin master --force
/*For Update - Run these command in terminal*/
git add .
git commit -m "your message"
git push
This is how I got mine working using Android Studio UI:
Delete .git folder from your project folder.
Delete .git folder from all your project subfolders.
Open project in Android Studio.
Settings, Version Control, remove all the roots
Go to VCS, Import into VC, Create git repository
Select the directory
Make sure your folder is the only root in Settings, Version Control
Go to VCS, Import into VC, Share project on Github
Mark as private if wanted.
Select all the files for initial commit, including app folder
Add files, select all in your project folder and app folder.
VCS > Commit -> to commit the files.
VCS > Git > Push -> to push the files.

Connecting to GitLab repositories on Android Studio

I'm trying to connect to a GitLab repository using the I/O preview of Android Studio. Does anyone know how to do this/if it is possible yet?
How to add an Android Studio project to GitLab
This answer shows how to do it using the Android Studio GUI.
1. Create a new project on GitLab
Chose the + button on the menu bar. Add a project name and then click "Create project".
This will give you a new project address. Choose the https version.
It will look something like this:
https://gitlab.com/MyUserName/my-project.git
2. Create a Git repository in Android Studio
In the Android Studio menu go to VCS > Import into Version Control > Create Git Repository...
Select the root directory of your project. (It will be automatically selected if you already have it highlighted in the Project view. Otherwise you will have to browse up to find it.)
3. Add remote
Go to VCS > Git > Remotes.... Then paste in the https address you got from GitLab in step one.
You may need to log in with your GitLab username and password.
4. Add, commit, and push your files
Make sure you have the top level of the project selected. If you are in the Android view you can switch it to the Project view.
Add: Go to VCS > Git > Add.
Commit: After adding, do VCS > Git > Commit Directory. (You will need to write a commit message, something like initial commit.)
Push: Finally, go to VCS > Git > Push.
Finished!
You should be able to view your files in GitLab now.
See also
There is a plugin that would probably streamline the process. Check it out here.
To clone a repo
Open a new project in Android Studio.
Click VCS -> Checkout from version control -> Git
then enter the URL of the repo and your local direcory
To commit
Open the project you want to push in Android Studio.
Click VCS -> Enable version Control -> Git
There does't seem to be a way to add a remote through the GUI. So open Git Bash in the root of the project add do git remote add <remote_name> <remote_url>.
Now when you do VCS -> Commit changes -> Commit & Push you should see your remote and everything should work through the GUI.
See these pages for details:
http://www.jetbrains.com/idea/webhelp/using-git-integration.html
http://youtrack.jetbrains.com/issue/IDEA-87099
Use CodeStream plugin, easy configuration

Categories

Resources