git上传代码

初次上传

cd existing_foldeer

git init 

git remote add origin ******/*.git

git add .

git commit -m "first commit"

git push -u origin master

新建分支,并将代码上传到分支上

cd existing_foldeer

git init

git remote add origin ******/*.git

touch t.txt

git add t.txt

git commit -m "add t.txt" (主分支是在我们第一次提交后创建的。让我们提交一个文件并检查分支列表)

git branch 分支名

git checkout 分支名

git add .

git commit -m "first commit"

git push -u origin 分支名

出现如下问题1: 

 fatal: unable to access 'https:/[email protected]/*': Failed to connect to github.com port 443: Timed out

fatal: unable to access 'https://[email protected]/*': Empty reply from server

解决方案:

 查看本机代理端口号。

在终端输入指令:

git config --global http.proxy http://127.0.0.1:本机代理端口号

 问题2:

fatal: Authentication failed for 'https://github.com/usrname/*.git/'

解决方案:

点击右上角头像--点击settings-- Developer Settings--personal access tokens--token(classic)--generate new token(选第二个classic)

你可能感兴趣的:(git)