git 相关知识

2023-06-19  本文已影响0人  果蝇的小翅膀

1、更改remote从https改为ssh

#查看git的状态
git remote -v

#origin https://github.com/qingjian1991/Manec (fetch)
#origin https://github.com/qingjian1991/Manec (push)
#更改git的属性
git remote set-url origin git@github.com:qingjian1991/Manec.git
git remote -v

#origin git@github.com:qingjian1991/Manec.git (fetch)
#origin git@github.com:qingjian1991/Manec.git (push)

git remote的管理

2、创建新的仓库并且上传文件
在GitHub上创建新的仓库,并且不要添加README, .gitignore or License file等文件

# create a new directory, and initialize it with git-specific functions
git init my-repo

# change into the `my-repo` directory
cd my-repo

# create the first file in the project
touch README.md

# git isn't aware of the file, stage it
git add README.md

# take a snapshot of the staging area
git commit -m "add README to initial commit"

# provide the path for the repository you created on github
git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPOSITORY-NAME.git

# push changes to github
git push --set-upstream origin main

https://docs.github.com/en/get-started/using-git/about-git

https://backlog.com/git-tutorial/tw/stepup/stepup2_4.html

上一篇 下一篇

猜你喜欢

热点阅读