GIthub repository not found error on Android Studio 2.1.2 after changing the repository - android-studio

I delete my old Github Repository (name: RealmDemo) and create the new repo with new name: daftar-negatif-investasi. I'm on Windows 10 and I have removed the old remote repository and added the new one using the following command (using Git Bash):
git remote rm origin
git remote add https://github.com/masumo/daftar-negatif-investasi.git
But, Android Studio always give me this error message:
Failed with error: fatal: repository
'https://github.com/masumo/RealmDemo.git/' not found
when I try to push into my Github repository.
I believe the remote repository already changed, because running git remote -v command give me this result:
origin https://github.com/masumo/daftar-negatif-investasi.git (fetch)
origin https://github.com/masumo/daftar-negatif-investasi.git (push)
It seems Android Studio still refers to the old repository. Any solutions for this problem?

Try this:
Open the /.git/config file and delete the lines:
[remote "origin"]
url = https://github.com/githubaccountname/MyProject.git
fetch = +refs/heads/*:refs/remotes/origin/*

git remote rm origin
git remote add origin git#github.com:username/MyApplication.git
git push -u origin master
Then it should work.

Try add origin
git remote add origin https://github.com/user/repo.git

It was my failure in identifying the working directory. After I refactor my project into the new name, somehow Git Bash application move the default working directory to the upper level. I didn't notice this and all those commands are executed against the upper level of my new project directory.

Related

Folder's content are empty after pushing into bitbucket

I wanted to push folders from my local repositories into bit bucket. Somehow I was unable to do that.
I got the solution somewhere to use
$ git push -f origin master
which resolved the issue but erased all lines of code.
This is my very first use of bit bucket. How to get all content back?
Now, I deleted previous repository and created the new one. Typed below but getting error
$ git remote add origin
https://PoojaThapa#bitbucket.org/PoojaThapa/git-poojatest.git
fatal: remote origin already exists.
$ git push origin
fatal: HttpRequestException encountered.
An error occurred while sending the request.
remote: Not Found
fatal: repository 'https://PoojaThapa#bitbucket.org/PoojaThapa/git-
test.git/' not found
please suggest.
Assuming you have a repository in your current directory you can add a remote with any name using:
git remote add <remote-name> <url>
You are getting an error with your first command because a remote already exists called origin.
Try git remote -v to see which remotes you have already got defined.
In your case I think you want to create a new remote (with a different name, for example bitbucket), so
git remote add bitbucket https://PoojaThapa#bitbucket.org/PoojaThapa/git-poojatest.git
Verify that the remote was created correctly using git remote -v, then you can push to the new remote using <remote-name>/<branch>:
git push bitbucket/master
"repository not found" implies that the origin URL is incorrect. List your current remotes with git remote -v, and double-check that you have the correct URL(s) listed. (You should be able to go to the URL in your browser.)
If something is incorrect, you can fix it with git remote set-url origin correct-url-goes-here.

How do i add and sync my local git on server? What is bare repo?

I am using git from a long time but never set it up on server. Refereeing to this Git: move existing repository from PC to server, clone from server
I have initiate a bare repo on server but while adding origin in local
"git remote add origin server:path/to/repo" i have no idea what to add here. My site is getwalkwel.com and user is getwamld
Thanks
Origin is the name of a remote which is typically created automatically when you clone a repo from another repo. The origin reference in the cloned repo will be created to point back to the repo that was cloned from.
In your case, where the bare repo was actually created later from your working repo, you will create origin in your working repo to point back to your new bare repo.
This is done with:
git remote add origin /barerepo/fullname
If your bare repo is going to line on a different machine, then you need the URL to reach the repo instead of just a file path.
For instance, you might have myuser#myserver:path/to/repo
Bare repository in Git is a repository which only contains version control information only in fact this will not have .git sub-directory or any working files.
This kind of repository is helpful when you need to share or divide your work between few people for example in work environment you and your team mates are working on same project and you all need to see changes and all needs to do push to repository in this case this repository is more useful.
You can add the remote repository to local git repo
$ git remote add origin ssh://myserver.com/var/git/myapp.git
pushing to remote repository:
to push our local master branch to the origin's master branch. You can do that using the git push <target> <local> command.
$ git push origin master
click here for more information on how this works

Add bitbucket repository to heroku project

I set-up a heroku Node project. Everything works fine but I would like to be able to push also on my bibucket repository. Git is set-up for Herokuy but when I try to add the bitbucket repository with the command:
cd /path/to/my/repo
git remote add origin git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
I get the following error:
fatal: remote origin already exists.
So I tried to run the command
git push origin master
And I get the response:
Username for 'https://github.com':
How can I push both in heroku and on my bitbucket repository?
You already have an origin repo defined (as github) so if you have the git project in bitbucket so you just need to reference as a new repo
git remote add bitbucket git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
then you will be able to run
git push bitbucket master (or any branch you have defined)
If you do not want to use github anymore and replace your origin repo with bitbucket, do
git remote set-url origin git#bitbucket.org:MYUSERNAME_/PROJECTNAME.git
and then
git push origin master
will push to your bitbucket repo - make sure to follow heroku instructions to add the heroku repo and push your files there to be deployed
Deendayal Garg gave me the right hint: with:
git remote -v
I could see that I had the original repository as origin remote. I deleted that, I unshallowed it (because the original repository was cloned with the -depth option) and I finally could add my personal bitbuket remote!

Undo user delation and removal of his project

In our own Gitlab server, I accidentally removed the default admin, and the previous repo created by this default admin, is also gone.
How to recover the missing repo?
Following merlin2011's suggestion, I finally cloned my local copy to the gitlab server:
git remote -v // list all remote repo
git add repo 192.168.1.xxx //our local git server
git push -u repo master
git remote remove repo
git add origin 192.168.1.xxx

Uploading code in Gitorious

I created an account in Gitorious and I want to upload code from my computer, but I don't know how to do it. Searching in internet I realized that I can't watch the menu to upload code from the dashboard.
I created the public SSH Key and I created a project and a repository. How can I upload the code from my computer?
Thanks.
The answer :
add new project and new repo on gitorious
on your local disc in program directory :
git init
git add .
git commit -m " name "
git remote add origin git#gitorious.org:my-project-name/my-git-repo.git
git push origin master
If you will have error :
fatal: remote origin already exists.
then :
git remote rm origin
git remote add origin git#gitorious.org:my-project-name/my-git-repo.git
git push origin master
It is based on :
faq - How do I point my local Git repository at Gitorious?
Creating a new git repository in Gitorious by kosmas
Getting started with Git and Gitorious by sagarun

Resources