Can't mirror gitlab repo to github - github

I've tried inputting:
https://<username>#github.com/<username>/<repo> + access token
https://<username>#github.com/<username>/<repo> + password
https://#github.com/<username>/<repo> + access token
https://#github.com/<username>/<repo> + password
ssh://<user>:github.com/<username>/<repo>
But none of them result in a successful update.
I have no clue what the issue could be, can someone explain step by step how to do this?
I have watched and read several tutorials but none have been able to get this to work.
Notes
The repo is public

Mirroring a GitLab repository would work with an authentication method which would be:
Public key authentication for SSH URL, using a GitHub deploy key registered to the target repository.
Make sure the URL is:
ssh://git#github.com/<username>/<repo>
^^^^
It is ssh://git#github.com/..., not ssh://<user>:github.com/
Or: password for HTTPS URL, except that password is, for GitHub repository, a PAT (Personal Access Token).
The URL would be:
https://github.com/<username>/<repo>
No need to add <username>, since your PAT will authenticate you anyway.

Related

Using same SSH Key for both Bitbucket and Github

I'm using same email address on both platforms. Please let me know if it's possible, if not please guide me to best practice.
Thanks in advance.
I have successfully added the key to Bitbucket, all good here. When I tried to login GitHub via CLI (using gh auth login), I have faced this text:
HTTP 422: Validation Failed (https://api.github.com/user/keys)
key is already in use
While using a dedicated key pair for Github is the best practice, you can also use gh auth login with HTTPS and as a password a GitHub PAT (Personal Access Token, typically, a classic one, scope repos)
echo ghp_xxx | auth login -p https --with-toke
gh auth status and gh auth token will confirm you are correctly logged in to GitHub, with the right identity.

How To Re-Athenticate expired GitHub authentication [duplicate]

The PAT that I used for the past month has expired, I am unable to push changes to the repository, how should I go about creating a new token or reauthenticate using my password?
I had the same issue. There is a regenerate token button that allows to set a new end-date, but it doesn't produce a new PAT nor re-vive the old PAT.
The only thing that worked for me is generate a new token and replace them in the .git/config files (or use the equivalent git config command).
All in all, I think using an SSH url with github (git#github.com:<user>/<repo>.git) and publishing your public SSH key as authorized key in github is much more proven and convenient, even though github (microsoft) doesn't encourage it.

I'm unable to run github cli commands because I keep running into an Authentication Error. I'm using the correct username and password. Details below

I'm following the steps listed here to try and link an existing local project to a new repo on GitHub.
I ran gh repo create but got an Authentication error, with a note to update my credentials in the .gitsomeconfig file. I ran gh configure and entered my GitHub username and my GitHub password (since I chose that option instead of using an authentication token). I entered them exactly the same as I type them in. Then I ran gh repo create again and still ran into the Authentication error. I output the content of .gitsomeconfig and verified that the user_login is correct (It doesn't display my password anywhere).
I've tried running gh configureat least 6 times now. I've copied and pasted from Lastpass to be extra sure I'm entering credentials correctly. I've tried both my username and my email address since I wasn't sure which gh configure actually wanted for username, but neither seem to work. I'm at a loss for what might be going wrong. Any thoughts or suggestions?
The right command is gh auth login, using your GitHub account name and your GitHub token (not password, your PAT: Personal Access Token, with scopes "admin:org, gist, repo, user, workflow")
Then you can check with gh auth status.
Once the status is clean (authenticated), you can proceed with other commands, like gh repo create.

Git pull in GitHub as collaborator

I'm the admin in a GitHub repository and I've added a collaborator, this collaborator needs to pull the repository and the system asks the access token.
How can a collaborator download a GitHub repository and how I create an access token for them?
I've found the solution, basically the collaborator needs to create an access token and then clone the repository, when prompted for Username, fill the username and when prompted for password you need to put the access token (not the password).
You do not need to provide them an access token. Assuming your repository is private, the collaborator needs to authenticate to GitHub when pulling (and when pushing even if the repository is public). The should do that by setting up their own account appropriately.
That can be by using their own personal access token as the password when prompted for the username and password over HTTPS, which they can create in the settings page, or they can create an SSH key and upload the public part to GitHub, and then use SSH to clone from or push to the repository.
The collaborater can clone the repo to their terminal using their own personal access token.

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.