[CS61b] Git设置、问题及解决方式

因为我不是UCB的学生,所以过程跟课上文件讲的可能不一样。

0.预先准备

Lab 1 Setup: Setting Up Your Computer | CS 61B Spring 2018 (datastructur.es)

1.Git设置

  1. 建立一个文件夹 (例:D:\桌面\cs61b)
  2. Github自己账号创建一个repositories, 命名随便(例: cs61b-sp18)
  3. 完成以上步骤后打开git bash, 输入以下命令
cd cs61b(**你的文件夹地址**)
git clone https://github.com/**你的repositories地址**.git
cd **新创建的空文件夹**
 git remote add skeleton https://github.com/Berkeley-CS61B/skeleton-sp18.git
git pull skeleton master

完成HelloWorld.java、HelloNumbers.java的作业后放进cs61a\**新创建的文件夹**\lab1里

git add lab1/*
git commit -m "completed first part of lab1"
git push origin master

最后回到自己github创建的repositories,看看能不能看到下图的样子,如果能即大功告成。 

2.出现问题及解决方式

1)git clone出现问题

git clone https://github.com/**你的repositories地址**.git

fatal: unable to access 'https://github.com/Avocad1/cs61b-sp18.git/': OpenSSL SSL_read: Connection was reset, errno 10054

或者
fatal: unable to access 'https://github.com/Avocad1/cs61b-sp18.git/': Failed to connect to github.com port 443 after 21110 ms: Timed out

解决方式:

应该是连接到github时网络问题,需要连梯子,连完梯子后,查看代理的localhost和port是多少

然后在Gitbush输入

$ git config --global http.proxy "**你的localhost:你的port**"

解决。

2)git pull skeleton 出现问题

git pull skeleton

You asked to pull from the remote 'skeleton', but did not specify
a branch. Because this is not the default configured remote
for your current branch, you must specify a branch on the command line.、

git输入以下命令:

git pull skeleton master
$ git commit -m "init"
git branch --set-upstream-to=origin/source

解决。

3)git push origin master出现问题

git push origin master

src refspec master does not match any

- 可能1 : 应该是add - commit 那一步做的有问题。

- 可能2:

git show-ref

看有没有refs/heads/master(现在改成main了),然后再

git push origin HEAD:master

解决。

  • 17
    点赞
  • 35
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值