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

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

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

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

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

x
如题。
. Waral dи,
老选手转码。今天在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 都可以。.--
. 1point 3acres
```
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记录。
然后我从网页登陆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. 1point 3 acres
  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. . 1point 3acres
  18. Changes to be committed:
  19.   (use "git restore --staged <file>..." to unstage)
  20.         new file:   ASiG.cs
    . 1point 3 acres
  21.         modified:   Business Mode.md
  22.         modified:   README.md

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

  36. nothing to commit, working tree clean
  37. asig@asig-Vostro-5402:~/Documents/ASiG$ git remote -v. 1point3acres
  38. origin        https://github.com/Railway-Wei/ASiG.git (fetch)
  39. origin        https://github.com/Railway-Wei/ASiG.git (push)
  40. asig@asig-Vostro-5402:~/Documents/ASiG$ git push. 1point 3 acres
  41. Username for 'https://github.com': railway.wei@gmail.com. check 1point3acres for more.
  42. Password for 'https://railway.wei@gmail.com@github.com':
  43. remote: Support for password authentication was removed on August 13, 2021..google  и
  44. 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..
  45. fatal: Authentication failed for 'https://github.com/Railway-Wei/ASiG.git/'
  46. asig@asig-Vostro-5402:~/Documents/ASiG$ git push
  47. Username for 'https://github.com': Railway-Wei
  48. Password for 'https://Railway-Wei@github.com':
  49. remote: Support for password authentication was removed on August 13, 2021.
  50. 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.. Χ
  51. fatal: Authentication failed for 'https://github.com/Railway-Wei/ASiG.git/'
  52. asig@asig-Vostro-5402:~/Documents/ASiG$

复制代码
回复

使用道具 举报

🔗
 楼主| VkS 2023-4-13 01:57:35 | 只看该作者
全局:
本帖最后由 VkS 于 2023-4-12 14:14 编辑
. 1point3acres
自己接着搞。

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

然后安装了gh,按照指导一路用网页验证下来,发现自己的token也没有用到。但是push成功了。

谢谢两位大侠指点。人的智能就在于我自己都不知道自己遇到了什么问题,你们就能说到点子上。谢谢!


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

使用道具 举报

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

使用道具 举报

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

使用道具 举报

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

本版积分规则

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