Git with private repository
since git remove authorization through username and password, one must do a lot more job to reach his private repository
you expect this:
yibotian@Nicolette86132:~$ git clone https://github.com/Ebotian/Fanta-sea.git
Cloning into 'Fanta-sea'...
remote: Enumerating objects: 3118, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 3118 (delta 46), reused 73 (delta 19), pack-reused 3008
Receiving objects: 100% (3118/3118), 437.40 MiB | 9.82 MiB/s, done.
Resolving deltas: 100% (1352/1352), done.
Updating files: 100% (1016/1016), done.
but things goes wrong:
yibotian@Nicolette86132:~$ git clone https://github.com/Ebotian/Fanta-sea.git
Cloning into 'Fanta-sea'...
Username for 'https://github.com': Ebotian
Password for 'https://Ebotian@github.com':
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.
fatal: Authentication failed for 'https://github.com/Ebotian/Fanta-sea.git/'
you need some helps to fix that:
- prepare:
- access to github
- curl --version? :sudo apt install curl
- gpg --version? :sudo apt install gpg
- pass --version? :sudo apt install pass
- operate:
curl -L https://aka.ms/gcm/linux-install-source.sh | sh
#check
git config --global credential.credentialStore gpg
git-credential-manager configure
#expect---output
Configuring component 'Git Credential Manager'...
Configuring component 'Azure Repos provider'...
gpg --gen-key
#input your name and email
#expect---output
gpg (GnuPG) 2.2.27; Copyright (C) 2021 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Note: Use "gpg --full-generate-key" for a full featured key generation dialog.
GnuPG needs to construct a user ID to identify your key.
Real name: <MY_NAME>
Email address: <MY_EMAIL>
You selected this USER-ID:
"MY_NAME <MY_EMAIL>"
Change (N)ame, (E)mail, or (O)kay/(Q)uit? o
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: /home/yibotian/.gnupg/trustdb.gpg: trustdb created
gpg: key <random_numbers_and_alphabets> marked as ultimately trusted
gpg: directory '<SOME_DIRECTORY>' created
gpg: revocation certificate stored as '<SOME_FILE></SOME_FILE>'
public and secret key created and signed.
pub rsa3072 2023-06-21 [SC] [expires: 2025-06-20]
<MY_KEY></MY_KEY>
uid MY_NAME <MY_EMAIL>
sub rsa3072 2023-06-21 [E] [expires: 2025-06-20]
#then you should enter:
pass init MY_NAME(mentioned above)
#it may asks you create a new password, don't worry, create and remember it)
git credential-manager github login
#it may asks you to choose a way, i prefer login in browser
#check
git credential-manager github list
#expect---output
Ebotian(MY_GITHUB_USERNAME)
#finally! you could clone you private repository to your local machine!
#but i met this:
git clone https://github.com/Ebotian/Fanta-sea.git
Cloning into 'Fanta-sea'...
remote: Enumerating objects: 3118, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (88/88), done.
error: RPC failed; curl 56 GnuTLS recv error (-9): Error decoding the received TLS packet.
error: 1647 bytes of body are still expected
fetch-pack: unexpected disconnect while reading sideband packet
fatal: early EOF
fatal: fetch-pack: invalid index-pack output
#i close my proxy and fixed it
yibotian@Nicolette86132:~$ proxyoff
HTTP/HTTPS Proxy off
yibotian@Nicolette86132:~$ git clone https://github.com/Ebotian/Fanta-sea.git
Cloning into 'Fanta-sea'...
remote: Enumerating objects: 3118, done.
remote: Counting objects: 100% (110/110), done.
remote: Compressing objects: 100% (88/88), done.
remote: Total 3118 (delta 46), reused 73 (delta 19), pack-reused 3008
Receiving objects: 100% (3118/3118), 437.40 MiB | 9.82 MiB/s, done.
Resolving deltas: 100% (1352/1352), done.
Updating files: 100% (1016/1016), done.
#now you can start your work---privately and safely