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.
Related
in the past, I did not download the telegram source with the git but now i need update my source and I need connect myProject (my Unofficial Telegram), to mainProject (Telegram) on github. my IDE is Android Studio. git in Android Studio is in VCS menu. but I do not know what to do, for conect my project to github project.
Make sure you have git installed on your system. If not, go to this link and download it
https://git-scm.com/download/win
Right click inside your local project folder and select 'Git Bash Here'
(If you want to clone your entire GitHub project into your local project, do it by typing:
git clone https://github.com/DrKLO/Telegram.git
If you already have the files and you just want to update it, skip this cloning step)
Check if your project folder has .git folder in it. (Check the hidden folders too) If there isn't one, type the following in your GitBash window
git init
Add the link to your GitHub (remote origin) by typing
git remote add origin https://github.com/DrKLO/Telegram.git
Update your files with the GitHub source by typing
git pull origin master
If you just want to know how to connect your project in Android Studio to GitHub, here's a simple tutorial:
https://www.londonappdeveloper.com/how-to-use-git-hub-with-android-studio/
(Skip the steps where he creates a new GitHub repository and an Android Studio project, since you already have both)
For detailed understanding on using git and github, i suggest you take this course:
https://in.udacity.com/course/how-to-use-git-and-github--ud775
I am developing my Android app on Eclipse. It works fine and run properly. But, I want to migrate to Android-Studio. Here is what I am doing:
Create a repo in GitHub with .gitignore, a README.md and LICENSE files
From within my project folder run the following commands:
git init
git add .
git pull git-url master
git init (again)
git add . (again)
git commit -m "First commit"
git remote add origin git-url
git push -u origin master
From Android-Studio, I checkout the project from Git
Run the app from Android-Studio (after alot of configrations)
My concern is that ALL my project files and folders are pushed to the remote repo at GitHub, including for example: bin\ and .settings\ folders. Meanwhile, I only need to push the important and platform independenet files because I work in both windows/mac systems and in differnet locations (hence, this is the reason behind using version-control).
My questions are:
How to pull the files on GitHub first, and then use .gitignore to push the "important and platform independenet" files from my project folder into GiHub
What is the recommended method to export a project from Eclipse to Android-Studio while using GitHub ?! should I:
checkout the project from Git (as I am doing now) ?
use Eclipse Export Tool ?
or clone the project first into a directoty and then loaded into Android-Studio as an existing project ?
You can pull your files by git pull origin master command from GitHub.
Add the name of the directory/file in .gitignore file you don't want to push. see more
You can clone the project first into a directory then load it in Android-Studio.
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.
Enabling the version control and connecting it to the user account in android studio creates new repository on github for each project and pushes the project to it by default. However, I would like to know if there is a way to setup Android Studio to upload the project to specific folder in already existing repository on github?
As mentioned in the comments, you have to move all your files to that specific folder and commit & push that folder.
You can not commit & push files into something, that is not the idea behind Git. It's mostely about Version Control
First install git-bash (i won't go through the installation) if not installed.
Clone the project on your pc.
git clone repo-url
Now create the required folder (and add files which you want in that folder) inside the repository you cloned on your pc.
git add .
git commit -m "Message"
git push origin master
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