I have tried to configure android studio with git and messed up.
How to completely remove old git that I could create new one?
In order to drop the current git repository and create a new one you need to:
Go to the project's directory: cd PROJECT_DIRECTORY
Remove all the git specific files: rm -rf $(find . -name ".git*")
Initialize a new git repository: git init
This doesn't remove your project's files, only git configs
Just a simple way
Open the terminal in android studio.
git remote set-url origin <NEW GIT URL>
now the project url is changed from old link to new one. Then you can use >
git init
and upload your files. Happy coding :)
Delete the .git folder & .gitignore and start again.
Google for how to display hidden folders on windows to see the .git folder.
In Android Studio terminal in your project dir: Windows:
rd /s /q ".git"
Linux/Mac:
rm -rf .git
If you delete a git repository from github, you should also delete a folder name .git from your Android Studio root directory.
Then you have to close the project. And re-open it in Android Studio.
Then do these things: 1) VCS -> Enable Version Control Integration -> Git 2) In Project view in Android Studio, select the project root folder and right click on it. Then go to Git -> Add, after that Git -> Commit Directory, and then Git -> Repository -> Push .
Whenever you get prompts in this way, just click on appropriate options.
I find the top answer little bit too complicated, although fully functional. So here is maybe little bit easier to understand practice:
Assuming you already have project, and you want to change target (Bitbucket in my case) directory.
cd Your/project/location
git remote
(its name will be probably origin
)git remote remove yourOldRemoteName
git remote
(should display nothing)git remote add yourNewRemoteName repositoryUrl
(If you are using Bitbucket, your url will be something like https://yourUsername@bitbucket.org/your-company/yourRepository.git
and you will find it by clicking Clone
button in source folder of your repository or when creating the repository.)
Hope this will be useful!
Remove the git folder in Project directory
Run this command git init
in Terminal
Vcs=> Git=>remote and add new
Paste the new git URL
After, verify your GitHub credentials
Now new git attached to your project
Remove and add git
//progect_path is path where .git is located
cd <progect_path>
rm -fr .git
git init
For me, the better solucion using Android Studio with Flutter projects was:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.