Can't push my Angular project to my github repo - github

I'm trying to save my Angular project to a repo on github and am getting an error saying
Please make sure you have the correct access rights and the repository exists.
I found several posts on here helping people get their SSH keys setup which I also did successfully. When I run git commit -m "some message" I get a response back saying there's nothing to commit and that the branch is clean. I switched the origin back and forth from the HTTPS and SSH links with git remote set-url origin (path) to see if that would make a difference but still get the same error about having access rights when running git push -u origin "main". I don't know what else to do or what I might be missing, can anyone help?

Another approach is to use GitHub CLI gh
install it
authenticate yourself (using a PAT - token) with gh auth login
(double-check with gh auth status)
create a new GitHub repository from your existing local repository with gh repo create
Regarding the last point:
cd /path/to/repo
gh repo create my-project --private --source=. --push
Replace my-project by a new GitHub repository name (or delete your existing one first)
Everything will be initialized and pushed!

Related

gitlab push is asking for github credentials?

I'm trying to push some files to a Gitlab project which I've already created in the GitLab GUI. So I'm trying to add some files to that project which already exists.
When I try:
git remote add origin https://git.doit.wisc.edu/my_user_name/my-website.git
I get this error:
error: remote origin already exists.
So I figured I could move on to the next step in the documentation - git branch.
Then I use:
git branch -M main
I was prompted with:
I entered my keychain password and all seemed fine but when I try to do:
git push -uf origin main
The terminal reads:
Username for 'https://github.com':
I put in my username and then get this error:
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
It seems like git is confusing gitlab and github. I'm trying to push to gitlab, not github. I'm so confused here. Is there something I'm missing in the first step?
No, Git's not confused here. When you said, git remote add origin… and Git reported an error, that means that the remote origin already exists for that repository. In this case, that remote points somewhere on GitHub, which you can see with git remote -v.
If you want to replace the existing URL for the origin remote, use git remote set-url origin https://git.doit.wisc.edu/my_user_name/my-website.git. If you want to create a new, differently named remote, then do git remote add gitlab https://git.doit.wisc.edu/my_user_name/my-website.git and push with git push gitlab main.
Note also that GitHub no longer allows you to use your account password to authenticate with Git. Instead, when prompted for a password, go to https://github.com/settings/tokens and create a token with the repo scope, and use that instead. However, in this case, since you're intending to push to GitLab, that shouldn't matter here.

Cannot clone private repo in which I am an admin even with SSH keys / OAUTH

I use GitKraken with OAUTH and work often with private repositories without issue. I was recently invited to a repo that is owned by an organization and is private. I am an admin on the repository. It appears forking is disabled but what is strange is when I try to clone it, I receive the following popup:
It also doesn't show up in my list of available repositories though the rest of my private repos do appear. Trying to figure out if there is some odd organizational permission I need to get fixed.
It is best to switch back (temporarily, for testing) to command-line and check what origin is:
cd /path/to/repo
git remote -v
Make sure it is an SSH GitHub URL (git#github.com:me/myRepo)
You can test its access (even without cloning it) with:
git ls-remote git#github.com:me/myRepo

how to solve the requested URL returned error: 403 on bitbucket? and setup to push both on github and bitbucket?

I forked a repo from bitbucket for my internship test. I worked on it. then I did:
git init
hub create
now when i have to push to bit bucket and I want
to push also on github but i get this error:
unable to access 'https://bitbucket.org/aaa/bbb.git/': The requested
URL returned error: 403
I never used bitbucket and always github. I wanna be able to use both. The repo is open to everyone and I need to make a pull request to let them evaluate my code. I dont understand how need to install ssh key/bitbucket credentials on my local machine to access it. It seems confusing.
DOES anyone have any clue how to set up both bitbucket and github and fixing this error? I have to hand in by the end of the week and I am lost.
The repo is open to everyone
For pulling/cloning, yes, it is opened to everyone, not for pushing.
Only the owner/collaborators of the bitbucket.org/aaa/bbb.git can push to it, so if you want to make a pull request from a BitBucker repository, you need to push to to your fork, not the original repository.
You can push to multiple repositories:
git remote set-url --add --push origin https://github.com/<you>/<yourRepo>
git remote set-url --add --push origin https://bitbucket.org/<you>/<yourFork>
# Or, if you are using a registered SSH key to your BitBucket account
git remote set-url --add --push origin git#bitbucket.org:<you>/<yourFork>

How can collaborators push their changes to my repo in GitHub

First I have created one project in Eclipse and committed to my GitHub using below commands:git init
git add .
git commit -m "first commit"
git remote add origin URI of my repo
git push -u origin master
Then I modified one file in Eclipse and committed to GitHub from Eclipse through creating remote and giving the remote URI of the repo.
I added my team member through add collaborator.
Then he downloaded my project and made a change in a file in Eclipse.
Now, how can he push that modified file to my GitHub repository from within Eclipse?
We have done one thing. He created a remote and gave the URI of my repo. But still we are unable to commit that file.
You need to add your colleague as a collaborator. This can be done in the desired GitHub repo via Settings > Collaborators (you need to type in your password again). Afterwards they have those permissions.
UPDATE
Sorry and good morning ;)
I overlooked that you already added your partner as a collaborator. Another possible reason for your situation could be in the Temporary interaction limits where you can, amongst others, limit the interaction with your repo to prior contributors.
If that doesn't help. Please add some more informations about your colleague's git logs.
UPDATE 2
#Rahul K regarding your comment (which you better add to your question, for faster recognition), your colleague first needs to integrate the remote changes via git pull origin master in order to be able to push his or her changes afterwards. But be aware that he or she might need to migrate any conflicts to files both of you applied changes to.
Best regards, David
I have resolved the issue by cloning the repo in my local folder, adding the project to eclipse and changing the file committed.
Before that you have to add that person as a collaborator. So that he/she can clone your repo using the command below:
git clone "Path to the repository"
This is an old question but I'll like to say this to help others that might still be facing this same issue.
I also faced this issue with a friend. I already made him a collaborator but he couldn't push. What we did to solve it was to clone the repo using the ssh url instead. Then we set up authentication in git with ssh. And we were able push successfully.
If you already cloned the repo with the usual HTTPS url, you can change the remote origin url using the git remote set-url origin <url> command but url here will be the ssh url.

Unable to git push julialang

I'm trying to get the latest julia master commit.
I instaled it via git clone, however, when I do
$ git push
It returns an exception:
fatal: remote error: You can't push to git://github.com/JuliaLang/julia.git
Use https://github.com/JuliaLang/julia.git
If I use the option given, git requires me a password.
It sounds like you probably don't actually want to push to the JuliaLang repository, but rather pull from it.
You git pull to fetch upstream changes and integrate them into your local repository. So, for example, to update and rebuild Julia, you would git pull && make clean && make from within julia's directory while on the master branch.
You would only git push if you were a contributor submitting changes. But even among contributors who have commit access, very few actually push directly to the master branch. Most create branches, submit those, and then open a pull request for a review. And for that workflow, you don't even need to be a contributor. You can "fork" the project on Github, and then push to your forked repository online. From there, you can open a pull request for review.
git:// doesn't allow for authentication.
ssh or https does.
In the case of https, it is asking for your GitHub username and password.
See more at "Git - the Protocols".
GitHub needs to know who you are, because only the owner (or a collaborator) has the right to push (while everybody can clone/pull from a public repo, which is why git:// works for cloning).
See "Permission levels for a user account repository".
Note: here github.com/JuliaLang is an organization, which means only the owner and members/teams can push to a repo declared in that organization.
Se more at "Permission levels for an organization repository".