【发布时间】:2024-05-04 04:55:02
【问题描述】:
我需要 git 方面的帮助。 我有一个服务器、用户名和 parol。我成功连接了 ssh,但我无法添加文件。当我想使用 git add 使用 bash 添加文件(从我的本地电脑)时,它返回找不到文件路径或路径不存在。我认为它正在搜索服务器中的文件或目录。
谢谢。
【问题讨论】:
我需要 git 方面的帮助。 我有一个服务器、用户名和 parol。我成功连接了 ssh,但我无法添加文件。当我想使用 git add 使用 bash 添加文件(从我的本地电脑)时,它返回找不到文件路径或路径不存在。我认为它正在搜索服务器中的文件或目录。
谢谢。
【问题讨论】:
使用 Git,您无需直接在服务器上创建存储库。相反,你
git init),git add)git commit)git remote add)
git push)示例脚本:
$ cd your_local_project_dir/ # Get into your your project directory
$ git init # Initialize a local repository
$ git add --all # Stage all files from your local project
# directory for commit (note this is not
# adding to the repository yet, it's just
# "prepare them to add into the repo")
$ git commit -m "Initial commit" # Add the staged files to the local repository
$ git remote add origin https://server.com/user/project_name.git
# Link the local repository to a remote one
$ git push -u origin master # Upload you local repository data to the
# remote one
【讨论】: