我使用MAC,我被告知要备份我的代码并跟踪我的工作

问题描述 投票:-2回答:3

任务:

将代码推送到存储库。

为了备份代码并跟踪您的工作,您需要提交您对项目存储库所做的更改。您必须打开终端并cd到正确的文件夹中,该文件夹包含此分配的克隆存储库。到那里之后,您将必须完成以下三个步骤:

1)暂存你的代码

git add -a

2)创建阶段代码的版本

git commit -m'创建了游戏逻辑'

3)将您的代码推送到GitHub存储库

git push origin master

我的最终结果:

Roberts-MacBook-Air:wdi-fundamentals-memorygame robert$ git add -a
error: unknown switch `a'
usage: git add [<options>] [--] <pathspec>...

    -n, --dry-run         dry run
    -v, --verbose         be verbose

    -i, --interactive     interactive picking
    -p, --patch           select hunks interactively
    -e, --edit            edit current diff and apply
    -f, --force           allow adding otherwise ignored files
    -u, --update          update tracked files
    -N, --intent-to-add   record only the fact that the path will be added later
    -A, --all             add changes from all tracked and untracked files
    --ignore-removal      ignore paths removed in the working tree (same as --no-all)
    --refresh             don't add, only refresh the index
    --ignore-errors       just skip files which cannot be added because of errors
    --ignore-missing      check if - even missing - files are ignored in dry run
    --chmod <(+/-)x>      override the executable bit of the listed files

Roberts-MacBook-Air:wdi-fundamentals-memorygame robert$ git commit -m 'created game logic'
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)
nothing to commit, working tree clean
Roberts-MacBook-Air:wdi-fundamentals-memorygame robert$ git push origin master
Username for 'https: //github.com ': myusername
Password for 'https: //[email protected]': 
remote: Permission to ga-students/wdi-fundamentals-memorygame.git  denied to myusername.
fatal: unable to access 'https://github /ga-students/wdi-fundamentals-memorygame.git/': The requested URL returned error: 403

我甚至无法输入我的密码,我输入的内容没有任何打印输出,当我点击输入时,我收到上述错误消息。我已经阅读了这个问题的答案,但我无法解决它。请帮忙,谢谢。

git macos github push master
3个回答
1
投票

作为@RohitShedage留下的解决方案的替代方案,您可以运行git add --allgit add -A

请记住,git add .只适用于git已经跟踪的文件。


0
投票

请尝试git add .而不是git add -a


0
投票

试试git add -A,而不是git add -a

© www.soinside.com 2019 - 2024. All rights reserved.