I am very new to bitbucket and linux. I am trying to upload files from my local to bitbucket. I tried the following command:
git commit -m 'commit to master'
git push -u origin 'master'
Then I got an error like
fatal: 'origin' does not appear to be a git repository fatal: Could
not read from remote repository.
Please make sure you have the correct access rights and the repository
exists.
Then I tried
git remote add origin ssh://mjsofttechindia#bitbucket.org:mjsofttechindia/project.git
git push origin master
Then I got an error like
ssh: Could not resolve hostname
bitbucket.org:yourname: Name or service not known fatal: Could not read from remote repository.
Please make sure you have the correct access rights and the repository exists.
Please help. I don't know if this is correct or not. Please help me.
Change remote url to
ssh://mjsofttechindia#bitbucket.org/mjsofttechindia/project.git
git remote set-url origin ssh://mjsofttechindia#bitbucket.org/mjsofttechindia/project.git
Then you have to configure your name and email address (the one that you created your Bitbucket account with) in your local repository
git config user.name "Your Name"
git config user.email "you#email.com"
Then do a push again
git push -u origin master
Related
I try to commit a file to a gitlab repo, but I receive
git -c diff.mnemonicprefix=false -c core.quotepath=false
--no-optional-locks push -v --tags origin main:main remote: You are not allowed to push code to this project. fatal: unable to access
'https://gitlab.server.com/Edna/myproject.git/': The requested URL
returned error: 403 Pushing to
https://gitlab.server.com/Edna/myproject.git Mit Fehlern
abgeschlossen, siehe oben.
Therefore, I got a personal access token from my gitlab operator like:
abcde-aC5unFT3ELQT-VMZKSpV
How do I use this PAT? How to enable this in sourcetree git desktop tool?
Your local repository is configured to use HTTPS instead of git over ssh. The output of git remote -v should verify this. You will see something similar to:
origin https://gitlab.server.com/Edna/myproject.git (fetch)
origin https://gitlab.server.com/Edna/myproject.git (push)
Follow the instructions to create and add your SSH key to your GitLab account.
Then, use a SSH remote repository for origin.
$ git remote rename origin https-origin
$ git remote add origin git#gitlab.server.com:Edna/myproject.git
Then, try your git command.
I was new to Gitlab was trying to push my project from local machine to Gitlab.
Have done the SSH key and followed the instructions at Gitlab. Done the Git global setup. Was trying to add an existing folder , so i followed the instructions listed
cd existing_folder
git init
git remote add origin https://gitlab.com/sss/testnode.git
git add .
git commit -m "Initial commit"
git push -u origin master
but failed at the last step at the git push. The error message was
Tried adding the remote origin, but it was told it already exists. So not sure where it went wrong. Please help, much appreciated :)
Have done the SSH key
The problem is that you have defined your origin as HTTPS, not SSH.
Try:
git remote set-url origin git#gitlab.com:sss/testnode.git
That will override origin URL.
Independently, make sure your SSH key does work and allows GitLab to authenticate you as your GitLab account with:
ssh -T git#gitlab.com
Check out your credentials, if they are invalid, it wont give u to upload changes.
For Windows check this: https://www.digitalcitizen.life/credential-manager-where-windows-stores-passwords-other-login-details
For Linux check this: https://askubuntu.com/questions/30907/password-management-applications (if you do not know how to change credentials via terminal)
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.
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!
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