美文网首页
git 相关知识

git 相关知识

作者: 果蝇的小翅膀 | 来源:发表于2023-06-19 10:47 被阅读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

相关文章

网友评论

      本文标题:git 相关知识

      本文链接:https://www.haomeiwen.com/subject/faheydtx.html