I create a new project in Android Studio.
What should I do to make all the changes from AS committed to Hithab? Or how to connect any other versions control system correctly?
Answer 1, Authority 100%
Personally, I think bitbucket more preferable GitHub, as the conditions there are somewhat better, in particular free private repositories.
instructions, how to connect an existing Bitbucket or GitHub project :
Next instruction for bitbucket, almost the same need to do and for cloning a repository with GitHub (except for setting up a plug-in – in this case it will be a github plugin)
- Install the program Git
- Configure Git in AS (file – settings … – Version Control – Git : Indicate the path to git.exe and click the TEST button to make sure that all Works)
- put in AS BitBuket plugin (file – settings … – Plugins: browse repositories ) – in general, it can not be placed. Practical benefits, except that item appears: VCS – Import Into Version Control – Share Project … Called failed – it is necessary in order to “pour” a local project on BitBuckket – if your case , put if the project is already in the repository, then you can refrain.
- If installed plugin, configure bitbucket in AS (file – settings … – BitBuckket : We write a login and password to your repository and press the TEST button to make sure that everything still works)
- cloning the project from the repository to the computer. vcs – checkout from version control – git (not bitbucket in no case – this item is there, if you put the plugin, but it is not necessary to press it, it does not work anyway): We write in the string “VCS Repository URL “HTTPS address (not SSH) of your repository (you can get on the” Overview “page of your project in BitBuckket – the SSH button in the upper right corner – press and switch to HTTPS) – Press TEST, enter the password from the Bitbucket account, then invent the master – Password storage in IDE – if the enemies do not spin around, you can simply click OK and make sure that everything still works. In the fields below, choose where to clone the project and the name of the project folder
- Click Clone
- After some boot manipulations, the window appears with a question, whether it is not necessary to open the newly acquired project – agree.
The BitBuckKet project is synchronized with the local repository Git , you can continue to work on a long forgotten project.
Almost the same (except for setting up the plugin – in this case it will be a github plugin) you need to do it for cloning a repository with github
Connecting a new project to Github :
You need to first install the GIT itself, as in paragraph 1 above and specify the path to it in IDE (paragraph 2)
Usually plug-in github already installed in the IDE, if it does not need to be installed in the settings in the plugins section
Fill in the login \ password to the github account in the settings (if there is no account, it first needs to register): VersionControl – & gt; github
Select: VCS – & GT; Import Into Version Control – & gt; Share Project On GitHub and follow the sentences of the master.
Connecting a new Bitbucket repository :
still first need to install the Git itself, as in paragraph 1 at the beginning and specify the path to it in the IDE (paragraph 2)
put in AS plugin BitBuket (file – settings … – Plugins: browse repositories )
Fill in the login \ password to the bitbucket in the settings (if there is no account, it is pre-registered)
Select vcs – & gt; Import Into Version Control – & gt; Share Project .. and follow the sentences of the wizard.
PS: Methods are beneficial from hemorrhoids with SSH keys, GIT command lines and other dubious joys of the “classic” cloning.
PPS: Cloning an existing repository can be cloning from the starting start window (when no project is open) Projecting first to the configure section – settings (for setting up GIT), then in Checkout Project From Version Control – Git
UPD: Saving changes to the local and remote repository
All further work with the local and remote repository is made in the VCS section of the Android Studio main menu.
For example, in order to make changes in the project in the local and / or remote repository (Github) you need to do the following manipulation:
Some changes should exist in the project since the last commit in the repository, otherwise the new commit will not pass. Either, if only fastened to a remote repository (github), then there must be another comet.
Select: VCS – & gt; COMMIT CHANGES ..
A window appears in which we see the project files with changes, here you can choose which files should be in commote, and which – no (tick). By default, everything was chosen where there were any changes since the last commit – everything will fall into the repository. For a commit, you need to write a comment on it (Commit Message), you can also install additional parameters on the code, right.
Now, to complete the operation, you need to click on the button at the bottom, which is signed by Commit – This button hides three options:
a. Commit – the changes in the project will be added only to the local repository (Commit). Send to remote repository can be later, the vcs – & gt command; Git – & gt; Push
b. Commit and Push – in addition to the local repository, changes will be added (PUSH) and in remote repository (github)
c. CREATE PATCH – Make a patch. We will not stop on it.
Files in the project window on the left (Project Explorer) will be painted as follows , signaling About the status in relation to the VCS system.
Answer 2, Authority 12%
for this you need:
initiate repository in an existing project
execute the Git Remote Add [Reduction] [URL]
After successfully executing these commands, you can make changes to the local repository and send them to a remote server using the Git Push [Delete. Server] [branch]
All commands are performed in the Git Bash command interpreter, which is installed with the Git.
In Android Studio, this can be done like this:
vcs – & gt; Enable Version Control Integration, choose there Git
In the window that appears, enter the name of the remote repository and the link to it. After that, remote repository will be connected.
To send the changes to the GitHub server, you need to choose VCS – & GT in Android Studio; COMMIT CHANGES or CTRL + K key combination and change the COMMIT on Commit and Push, or do separately Commit and separately Push