查看: 1234| 回复: 5
跳转到指定楼层
上一主题 下一主题
收起左侧

[转CS-自学] VS Code can create a GitHub repository, but cannot commit

🔗
VkS | 只看该作者 |倒序浏览
全局:

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
如题。

老选手转码。今天在sd卡上装了ubuntu 22.04, VS Code,还有一堆有用的没用的乱七八糟。结果面前第一条小沟到夜里12点半也没过去。

本地文件夹里三个*.md文件,可以通过Git直接上传到GitHub的一个新的repository。但是只能在GitHub没有这个repository的时候这样做。第一次上传后,如果本地文件作了修改,或者添加了一个*.cs空文件,就没有办法commit。每次点击commit,VS Code就会一直思考啊思考,一直思考十几分钟,直到我不耐烦把VS Code关掉。如果不commit,直接push,貌似完成了任务但是GitHub上面的文件并不更新。

求大神指点,免得转码路上第一个困难就给我劝退了。谢谢!

上一篇:【ECE转码找工向】UCSD vs 西北 vs Brown
下一篇:录取了OMSCS,可以只刷个CS学历吗?
🔗
webpackKid 2023-4-12 13:02:25 | 只看该作者
全局:
用terminal吧, 至于怎么在terminal设置git, 问chatgpt,youtube 都可以。
. .и
```. ----
git add .
git commit -m "Added files"
git push
```
回复

使用道具 举报

全局:
没有screenshot很难给你debug啊
回复

使用道具 举报

🔗
 楼主| VkS 2023-4-13 01:11:44 | 只看该作者
全局:
本帖最后由 VkS 于 2023-4-12 13:17 编辑

多谢两位大侠!
chatGPT 还是差一些的,不像你们两句话都在点儿上。. Χ
我试着用Git直接在terminal里面搞,貌似commit成功了。结果git push提示我类似用户名密码错误什么的,请看下面的terminal记录。.1point3acres
然后我从网页登陆GitHub,确定用户名密码都没错。我是落下了某一步骤么?
  1. asig@asig-Vostro-5402:~$ cd Document
  2. bash: cd: Document: No such file or directory
  3. asig@asig-Vostro-5402:~$ ls
  4. Desktop    Downloads                               Music     Public  Templates
  5. Documents  google-chrome-stable_current_amd64.deb  Pictures  snap    Videos
  6. asig@asig-Vostro-5402:~$ cd Documents
  7. asig@asig-Vostro-5402:~/Documents$ ls
  8. ASiG
  9. asig@asig-Vostro-5402:~/Documents$ cd ASiG
  10. asig@asig-Vostro-5402:~/Documents/ASiG$ ls
  11. ASiG.cs  'Business Mode.md'   ChatGPTLog.md   README.md.
  12. asig@asig-Vostro-5402:~/Documents/ASiG$ git init
  13. Reinitialized existing Git repository in /home/asig/Documents/ASiG/.git/
  14. asig@asig-Vostro-5402:~/Documents/ASiG$ git status
  15. On branch main
  16. Your branch is up to date with 'origin/main'.

  17. Changes to be committed:
  18.   (use "git restore --staged <file>..." to unstage)
  19.         new file:   ASiG.cs. 1point 3acres
  20.         modified:   Business Mode.md
  21.         modified:   README.md

  22. asig@asig-Vostro-5402:~/Documents/ASiG$ git diff. Waral dи,
  23. asig@asig-Vostro-5402:~/Documents/ASiG$ git remote -v.google  и
  24. origin        https://github.com/Railway-Wei/ASiG.git (fetch)
  25. origin        https://github.com/Railway-Wei/ASiG.git (push)
  26. asig@asig-Vostro-5402:~/Documents/ASiG$ git add .
  27. asig@asig-Vostro-5402:~/Documents/ASiG$ git commit -m "I just want to push something back to GitHub"
  28. [main 8073f03] I just want to push something back to GitHub
  29. 3 files changed, 5 insertions(+), 1 deletion(-)
  30. create mode 100644 ASiG.cs
  31. asig@asig-Vostro-5402:~/Documents/ASiG$ git status
  32. On branch main
  33. Your branch is ahead of 'origin/main' by 1 commit.
  34.   (use "git push" to publish your local commits)

  35. nothing to commit, working tree clean
  36. asig@asig-Vostro-5402:~/Documents/ASiG$ git remote -v
  37. origin        https://github.com/Railway-Wei/ASiG.git (fetch)
  38. origin        https://github.com/Railway-Wei/ASiG.git (push)
  39. asig@asig-Vostro-5402:~/Documents/ASiG$ git push. 1point 3 acres
  40. Username for 'https://github.com': railway.wei@gmail.com
  41. Password for 'https://railway.wei@gmail.com@github.com':
  42. remote: Support for password authentication was removed on August 13, 2021.
  43. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
  44. fatal: Authentication failed for 'https://github.com/Railway-Wei/ASiG.git/'
  45. asig@asig-Vostro-5402:~/Documents/ASiG$ git push
  46. Username for 'https://github.com': Railway-Wei.google  и
  47. Password for 'https://Railway-Wei@github.com':
  48. remote: Support for password authentication was removed on August 13, 2021.
  49. remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.. Waral dи,
  50. fatal: Authentication failed for 'https://github.com/Railway-Wei/ASiG.git/'
  51. asig@asig-Vostro-5402:~/Documents/ASiG$

复制代码
回复

使用道具 举报

🔗
 楼主| VkS 2023-4-13 01:57:35 | 只看该作者
全局:
本帖最后由 VkS 于 2023-4-12 14:14 编辑

自己接着搞。
. Waral dи,
Terminal说现在已经不流行用户名密码了,要用token。按照GitHub指导,造了一个Fine-grained personal access token。给了好长一串,用vi存在一个文件里。正在研究怎么用这个东西。

然后安装了gh,按照指导一路用网页验证下来,发现自己的token也没有用到。但是push成功了。
..
谢谢两位大侠指点。人的智能就在于我自己都不知道自己遇到了什么问题,你们就能说到点子上。谢谢!-baidu 1point3acres
. 1point3acres

但是但是但是,VS Code还是不能commit。作为能力约等于0的老新人,果断放弃VS Code自带的 cource control功能。两位大侠有什么可以指点的还请继续。
回复

使用道具 举报

全局:
我一般用 source tree     win 的话小乌龟
回复

使用道具 举报

🔗
loveklmn 2023-4-28 11:41:02 | 只看该作者
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

>
快速回复 返回顶部 返回列表