git的问题
git可以绑定电脑上的一个文件夹,然后定期自动上传至github吗 是的,你可以使用Git将一个文件夹绑定到GitHub这样的远程仓库中,并通过Git定期自动上传文件夹中的变更到GitHub上。具体来说,你可以按照以下步骤进行操作:
1. 在GitHub上创建一个新的仓库。
2. 在本地计算机上安装Git,并设置自己的用户名和电子邮件地址。
3. 在本地计算机上打开文件夹,并初始化Git仓库。在终端或命令提示符中,使用 `git init` 命令初始化Git仓库。
4. 添加文件夹中的文件到Git仓库中。使用 `git add .` 命令添加所有文件到Git仓库中。
5. 提交Git仓库中的变更。使用 `git commit -m "Initial commit"` 命令提交更改。
6. 将本地Git仓库与远程仓库关联。使用 `git remote add origin 远程仓库的URL` 命令将本地仓库和远程仓库关联。
7. 推送本地Git仓库中的变更到远程仓库。使用 `git push -u origin master` 命令推送变更。
8. 可以设置自动上传功能,为此可以使用Git提供的hook技术,钩子是一些在特定的Git事件发生时执行的脚本。在你的本地仓库中,你可以在 `.git/hooks` 目录中找到多个示例脚本。你也可以为自己的仓库创建自定义钩子,以根据需要运行自己的代码。
这样,每次你对文件夹中的文件进行更改并提交这些变化到Git仓库之后,只要执行 `git push` 命令,Git就会将这些更改推送到关联的远程仓库中。 陶远航 发表于 2023-5-28 15:30
是的,你可以使用Git将一个文件夹绑定到GitHub这样的远程仓库中,并通过Git定期自动上传文件夹中的变更到Gi ...
这样,每次你对文件夹中的文件进行更改并提交这些变化到Git仓库之后,只要执行 `git push` 命令,Git就会将这些更改推送到关联的远程仓库中。
这里的git push命令是指git push -u origin master吗 是的,我的回答中提到的 `git push` 命令指的是 `git push -u origin master` 命令。其中 `-u` 选项告诉Git将本地仓库的分支与远程仓库的分支关联起来,并且以后可以使用 `git push` 命令直接将本地分支的更改推送到对应的远程分支上。`origin` 是远程仓库的名称,而 `master` 是要推送的本地分支的名称。 陶远航 发表于 2023-5-28 15:32
是的,我的回答中提到的 `git push` 命令指的是 `git push -u origin master` 命令。其中 `-u` 选项告诉Git ...
好的 歌者文明清理员 发表于 2023-5-28 15:31
这里的git push命令是指git push -u origin master吗
git push 跟 git push -u origin master 还是有区别的
-u 是 --set-upstream ,也就是说设置推送的上游
所以git push -u origin master在推送的同时还将设置默认推送的上游为 master 分支
这样做有什么好处呢?
好处就是在你下次要推送到 master 分支的时候直接 git push 就可以了,不用在后面加上分支
歌者文明清理员 发表于 2023-5-28 15:33
好的
解决了就给最佳{:5_109:} 陶远航 发表于 2023-5-28 15:30
是的,你可以使用Git将一个文件夹绑定到GitHub这样的远程仓库中,并通过Git定期自动上传文件夹中的变更到Gi ...
E:\xxx>git push -u origin master
fatal: unable to access 'https://github.com/dddddgz/website.git/': SSL certificate problem: unable to get local issuer certificate@isdkz 歌者文明清理员 发表于 2023-5-28 15:59
@isdkz
这个错误信息提示是 SSL 证书问题导致的无法访问 GitHub,可能是因为安装了不受信任的证书或者是网络代理等原因引起的。
你可以尝试以下方法解决此问题:
1. 确认你的本地时间和时区设置正确。如果时间设置不正确,SSL 证书验证会失败。在命令行中输入 `date` 命令并检查时间和日期设置是否正确。
2. 禁用 SSL 验证。在执行 `git clone` 或 `git push` 命令时,可以使用 `-c http.sslVerify=false` 选项禁用 SSL 验证。例如:`git clone -c http.sslVerify=false https://github.com/dddddgz/website.git`。
3. 更新 Git 版本。较旧版本的 Git 可能已经过时,在处理 SSL 证书时存在问题。请更新到最新版本的 Git。
4. 下载并安装最新的根证书。可能需要下载并安装最新版本的根证书以确保 SSL 验证可以正常工作。
如果以上方法都不能解决问题,你可以寻求专业人士的帮助,他们可能会深入分析问题并找到更好的解决方案。 陶远航 发表于 2023-5-28 16:00
这个错误信息提示是 SSL 证书问题导致的无法访问 GitHub,可能是因为安装了不受信任的证书或者是网络代理 ...
E:\xxx>git push -u origin master-c http.sslVerify=false https://github.com/dddddgz/website.git
error: unknown switch `c'
usage: git push [<options>] [<repository> [<refspec>...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
-d, --delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--force-with-lease[=<refname>:<expect>]
require old value of ref to be at this value
--force-if-includes require remote updates to be integrated locally
--recurse-submodules (check|on-demand|no)
control recursive pushing of submodules
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack>
receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
--prune prune locally removed refs
--no-verify bypass pre-push hook
--follow-tags push missing but relevant tags
--signed[=(yes|no|if-asked)]
GPG sign the push
--atomic request atomic transaction on remote side
-o, --push-option <server-specific>
option to transmit
-4, --ipv4 use IPv4 addresses only
-6, --ipv6 use IPv6 addresses only 歌者文明清理员 发表于 2023-5-28 15:59
@isdkz
你现在在浏览器不开插件(不用v*n)访问得了github吗? 歌者文明清理员 发表于 2023-5-28 16:03
很抱歉,我的回答有误。之前提到的 git push -c http.sslVerify=false 这个命令是不正确的,正确的命令应该是在执行 push 命令的时候加上 -c http.sslVerify=false 选项。具体命令应该是:
git push -u origin master -c http.sslVerify=false
请确保在执行命令时,-c http.sslVerify=false 选项紧跟在 push 命令的后面,而不是紧跟在仓库地址的后面。
如果还是无法解决问题,请尝试其他方法,如更新 Git 版本或重新安装证书等。 isdkz 发表于 2023-5-28 16:04
你现在在浏览器不开插件(不用v*n)访问得了github吗?
我用的是fastgithub 歌者文明清理员 发表于 2023-5-28 16:04
我用的是fastgithub
什么插件都不要用才能跟你的终端网络环境一致,看看能不能访问得了github 因为浏览器的插件作用不到终端的,你的当前网络环境访问不了github的话也就没法git push
页:
[1]