Git notes--Ubuntu uploads local projects to github

Table of contents

1--Basic configuration

2--Local upload


1--Basic configuration

① create ssh-key

cd ~/.ssh

ssh-keygen -t rsa -C "邮箱地址"

② View and associate ssh-key

gedit id_rsa.pub

        Copy the content, click Settings -> SSH and GPG keys -> New SSH key in GitHub, and copy the string in the id_rsa.pub file;

③ Check the association

ssh -T [email protected]

        The welcome message is output, that is, the associated authentication is successful!

2--Local upload

git init

git add .

git status

git commit -m  "first commit"

git remote add origin https://github.com/liujf69/TensorRT-Demo.git

# 用于设置令牌
# 格式: git remote set-url origin https://<令牌名称>@github.com/<用户名><仓库名>.git
git remote set-url origin  https://[email protected]/liujf69/TensorRT-Demo.git

git push -u origin master

# 输入令牌对应的密码即可!
# 密码在生成令牌时自动生成!

​​​​Set token:

        Settings -> Developer Settings -> Personal access tokens -> Tokens (classic) -> Generate new token;

        Check all the permissions by default, and set the valid time of the token at the same time;

        Pay attention to save the generated password, and it will disappear after refreshing;

        When pushing a new folder, you can first clone the remote warehouse (in order to synchronize the local warehouse with the remote warehouse), then add a new folder, and re-upload the push

Guess you like

Origin blog.csdn.net/weixin_43863869/article/details/132072349