My private repository became Not Found even if global GitHub account is defined after two-factor authentication is setup - github

I setup Two-factor authentication in my GitHub account.
Then, I generated my personal access token in GitHub and used it in order to clone my private repository.
However, it failed.
$ git config --get user.name
myusername
$ git clone https://github.com/xxx/MyPrivateProject.git
Cloning into 'MyPrivateProject'...
remote: Repository not found.
fatal: repository 'https://github.com/xxx/MyPrivateProject.git' not found
"myusername" has access permission and could exactly access to my private repository before two-factor authentication was setup.
Then, I tried following command and it worked well.
$ git config --get user.name
myusername
$ git clone https://myusername#github.com/xxx/MyPrivateProject.git
Cloning into 'MyPrivateProject'...
remote: Repository not found.
Cloning into 'ambie_co_jp'...
Password for 'https://myusername#github.com': <Personal Access Token>
remote: Enumerating objects: 475, done.
remote: Counting objects: 100% (475/475), done.
remote: Compressing objects: 100% (351/351), done.
remote: Total 475 (delta 96), reused 470 (delta 92), pack-reused 0
Receiving objects: 100% (475/475), 38.96 MiB | 5.06 MiB/s, done.
Resolving deltas: 100% (96/96), done.
I don't understand why I need to write "myusername#" in repository URL though "myusername" is already defined in .gitconfig as global user.
Could you give me any advice ??

After 2FA is setup, you would need to use a PAT as password, as shown here:
https://scuzzlebuzzle#github.com/<user>/<repo>
<enter <MYTOKEN> as password>
Those should be cached by a credential manager (like the GCM for Windows).

Related

Trouble pushing repo to my github account through gitbash

I always have this error message
remote: Permission to adebayo-pixel/liquiditycheck.git denied to yusuffhafees.
fatal: unable to access 'https://github.com/adebayo-pixel/liquiditycheck.git/': The requested URL returned error: 403

GIT: problem when i'am type $ git push -u origin main

remote: Permission to 17ekspor/17ekspor.git denied to icakstore69.
fatal: unable to access 'https://github.com/17ekspor/17ekspor.git/': The request
ed URL returned error: 403

How to configure github with proxy?

I am running through a proxy and i do not understand how to make git work.If i try to clone a repo i get the following error:
$ git clone https://github.com/somerepo
Cloning into '[something]'... fatal: unable to access
'https://github.com/somerepo': OpenSSL SSL_connect:
SSL_ERROR_SYSCALL in connection to github.com:443
I have already tried most of what it is saying here changing the git global and checked this SO thread too to no avail.
I have also tried to unset proxy for http and https.
Looking in my git config it looks like this:
[user]
name = Adri
email = [some_address]#outlook.com
[http]
sslBackend = openssl
sslCAInfo = C:\\Program Files\\Git\\mingw64\\ssl\\cert.pem
[remote "origin"]
proxy =
Could this be a problem ?
P.S I get this problem for all git operations, i can't clone,pull,push etc.. and for all repositories.

SSL: can't load CA certificate file /Users/xxxxx/goagent/local/CA.crt

server:~ Wanglichen$ pod setup
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.36.4/lib/cocoapods/command.rb:127:
warning: Insecure world writable dir /usr in PATH, mode 040777
[!] The signature of CLAide#arguments has changed.
Use CLAide::Argument (Pod::Command::CheckLatest: `[["NAME", :required]]`)
Setting up CocoaPods master repo
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --depth\=1
Cloning into 'master'...
fatal: unable to access 'https://github.com/CocoaPods/Specs.git/':
SSL: can't load CA certificate file /Users/Wanglichen/goagent/local/CA.crt
server:~ Wanglichen$

GitHub - how do I push?

Whenever I try to push, GitHub hangs for a while (~a minute) before outputting:
ssh: connect to host gmail.com port 22: Bad file number
fatal: The remote end hung up unexpectedly
I checked my SSH keys a few times. I was able to ssh github.com and when I do it asks me for my passphrase and then says, "Hi Aro! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed"
First of all, why is it trying to gmail.com when I am using git push? Why is it timing out if the ssh keys seem to be working? I don't see any firewall alerts. I don't think my router is blocking anything. I'm on Windows 7.
What do you think is the problem?
.git/config
[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
hideDotFiles = dotGitOnly
[remote "origin"]
url = my#email.com:MyGithubUsername/Hello.git
fetch = +refs/heads/*:refs/remotes/origin/*
Under [remote "origin"], the url value should be changed:
[remote "origin"]
url = git#github.com:MyGithubUsername/Hello.git
The authentication is purely done on the basis of keys, not the username or email address.