Github pat token not working while pushing to repo - github

We are using github private repo in my organization. we have pat token to repo with this pat token i can able to clone but i can't able to push my changes to github with this pat i was below error
git push https://pat:XXXXXXXXXXXXXXXXXXXXXXXX#github.com/companyname/helloworld.git HEAD:featurebranch -f
remote: You must verify your email address.
remote: See https://github.com/settings/emails.
fatal: unable to access 'https://pat:pat:XXXXXXXXXXXXXXXXXXXXXXXX#github.com/companyname/helloworld.git/': The requested URL returned error: 403

This message means that you must verify your email address by visiting the link provided and following the steps to verify your email.
GitHub requires this because it's easy to do but relatively effective at preventing spam and abuse, and it also means that if there ends up being a problem (e.g., your account ends up getting compromised or it's associated with excessive use), there's a way to contact you.
This is required in order to continue and even though your PAT is correct, you won't be able to push until your email is verified.

Related

Problems with cloning a git repository to new computer

This might be trivial, but it has caused me a ton of headaches over the last few days.
Recently i have tried to clone my git repos onto my new computer, but up until now, with no succes.
After typing "git clone " followed by the respective git URL, my comand line is asking for my Username and passwort. Even though i provide both correctly, i get the following error:
I do not have 2FA enabled, and as i understand it, the access token is only required in the case of enabled 2FA.
Does anyone have any idea what i am doing wrong?
A token is not jsut required for 2FA.
It is now (since mid 2021) required for any web operation with authentication, using said token as a password.
You need to create a PAT (Personal Access Token), with scope 'repo'.

Permission denied to git push as a contributor

Recently I have been added as a contributor to a program allowing me to make some changes but I can't git push my fixed code to the repo.
The error is as follows:
remote: Permission denied to myusername.
fatal: unable to access 'program URL': The requested URL returned error: 403
I can create a pull request to modify the file but my instructor said it would be troublesome if he had to check the request and merge them every time so he added me as a contributor.
I googled my question and some said I need to add my SSH key to my instructor's account, but does it mean I have permissions to all repo of my instructor?
I'm just a beginner in github, many thanks for your help!
You need to have an SSH key for your own account (not your instructor's). If he added you as a contributor and you cloned the repository via SSH (as it seems you did), Github will check your personal SSH key to identify you whenever you try to push.
Just follow these steps to add your SSH key to your account: https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account

VSCode Pull Requests - Organization

I have my personal GitHub account which has been given access to Repos that exist as part of an organization. I'm trying to create a pull-request from within VSCode for these Repos, but I get the below error.
Is there a setting I'm just missing?
[Info] GitHubRepository> Creating pull requests failed: HttpError: Validation Failed: {"resource":"PullRequest","field":"head","code":"invalid"}
HttpError
Check first if you have a git config credential.helper set (to, for instance on windows, manager-core)
If you have, that means the wrong credentials (username/password) are cached in said credential helper. They are not the ones for your organization GitHub account.
See GitHub "Caching your GitHub credentials in Git" and update them.

Trying to import GitLab repository to Azure repository but I am getting the below error

Import request cannot be processed due to one of the following reasons:
Clone URL is incorrect.
Clone URL requires authorization.
NOTE: I am getting this error even though I am providing the correct username and password. And I am able to clone the repository locally with the same clone url.
If you are using credentials (username/password) to clone the repository, that should mean its URL is an HTTPS one.
This answer suggests an issue with an empty repository or a wrong PAT.
The last suggestions reminds me you should try and use a token as your password, instead of your GitLab account password. See if you can create a PAT (Personal Access Token), and use that as a password.

After setting up two factor authentication, I get "Repository not found"

After our github has a two factor authentication setup, I can't do pull nor push on command-line due to an error of "repository not found".
C:\myproject>git push origin mybranch
Username for 'https://github.com': myname
Password for 'https://myname#github.com':
remote: Repository not found.
fatal: repository 'https://github.com/myproject.git/' not found
How to resolve this issue?
For folks who are facing the same issue,
Enabling 2FA requires us to use the Personal Access Token(PAT) instead of our password. PAT can be generated from Developer Settings tab. While generating the token make sure to give the necessary permissions(scope) like repo read/write access, etc.,
This worked for me.
Double-check your URL.
It should not be https://github.com/myproject.git/ but https://github.com/myusername/myproject.git/