Unable to add project to Github from android studio - android

I am getting the error as
" Can't add remote
fatal: remote origin already exists.
during executing git remote add origin https://github.com/Aditya547/HelloWorld12.git"
Although it is for the first time with that name , repo is being created but project is not getting into it

You can't add origin since its already there but you can update it. Instead of git remote add command, you can run from your git bash/command line:
git remote set-url origin git#github.com:Aditya547/HelloWorld12.git
find more in this link: More info

Related

How to add an Android Studio project to GitLab

I referred this link:
Connecting to GitLab repositories on Android Studio
In step 1, I am getting this
https://gitlab.com/pvijayalakshmi/eemployee.git
In step3, I am getting this error:
Remote URL test failed: Unable to find remote helper for 'https'
Why I am getting this error?
Please help me.
Any help would be appreciated.
You can follow a tutorial from Github, the principle is the same: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
Basically, you need to add git to your local project, commit all the changes and set up remote repository URL:
git remote add origin remote repository URL
Then you push your code to the remote repository.
You can create a project to Gitlab manually, Get project repo URL &
Clone the project locally by using the terminal. One last step Now add your files in the local folder.

Android Studio git: failed to traverse parents error

I've been running Android Studio on Windows, with git doing the versioning, and git pushing using git bash for Windows. I've been doing the same thing for all that time, without issue.
Then today, in the event log in Android Studio after opening I see:
17:29 VcsException
error: Could not read 5188c7b8677be145b04f079e6f9cab08e5c19240
fatal: Failed to traverse parents of commit 50da9e67a67598125b860984db9e493bd5d1f2ee
during executing git -c core.quotepath=false log HEAD --branches --remotes --max-count=2000 --pretty=format:%x01%H%x02%ct%x02%an%x02%at%x02%ae%x02%cn%x02%ce%x02%P%x02%s%x02%b%x02%B%x02%d%x03 --encoding=UTF-8 --decorate=full --
And when I try a git operation in the git bash console (Windows) I get:
$ git commit -m 'new stuff'
fatal: unable to read tree 4dfc5598677be145b04f079e6f9cab0833555566
The following is an extract from running git fsck... there is a long list which annoyingly in git bash is not scrollable or selectable:
$ git fsck
dangling blob 7be145b04f079e6f9cab0835664dfc5598673555
missing blob e6f9cab0835664dfc559e145b04f07986735557b
missing tree b04f07986735557be6f9cab0835664dfc559e145
... (lots of dangling blob, a few missing blob, one missing tree) ...
What can I do to fix this?
So, since I've been pushing regularly to the remote repo so I know that is pretty up to date, I followed the low-tech suggestion set out here, combined with the first comment to that suggestion.
So:
create a temporary folder in whatever location you want
clone the repo into that folder with git clone
git#bitbucket.org:myaccount/myproject.git
move the .git folder in the existing project folder out into another temporary folder somewhere
move the .git folder from the repo cloned in step 2 into the project folder, to replace the old one moved out in step 3
and that was it... a git add / commit / push we seem to be
back on track

Existing Android studio project import into Github. Push rejected?

I tried to follow this tutorial:
https://www.londonappdeveloper.com/how-to-use-git-hub-with-android-studio/
But when I push it says
Push rejected: Push to origin/master was rejected
I suspect is it the reason of remote add?
if my project path is https://github.com/myusername/projectname
My remote add should add github.com/myusername/projectname.git?
First, check if you inited the local git repository in your project's root directory.
Then check if you correctly added your remote origin.
Check the remotes:
git remote -v
If the existing remote origin is wrong, then change it:
git remote set-url origin https://github.com/myusername/projectname.git
If it's not existing, add it:
git remote add origin https://github.com/myusername/projectname.git

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/

github,eclipse and android

I'm new to git. I want to create a new project with Eclipse, and use Github to manage it.
The problem is, Github suggested me to add a .gitignore file to let it ignore files in bin, but once I did that, there is a new master in the Github's repository.
Then when I tried to push my project, it said:
To git#github.com:Benjaminz/SocialEventPlanner
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git#github.com:Benjaminz/SocialEventPlanner'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
When I ran pull it said:
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details
git pull <remote> <branch>
If you wish to set tracking information for this branch you can do so with:
git branch --set-upstream-to=origin/<branch> master
What mistake did I make? How to correct this?
Thank you. :)
it seems that ur poject is not stashed
Do Below Steps :
git stash
git pull
git stash pop
For the second error message, you can type:
git branch -u origin/master master
Then try again your git pull.

Categories

Resources