Adding an existing project to GitHub using the command line

本文详细介绍了如何通过命令行方式将现有的本地项目添加到GitHub上。步骤包括:创建远程仓库、初始化本地Git仓库、添加文件并提交更改、设置远程仓库地址及推送更改。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Adding an existing project to GitHub using the command line


https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/


1- Create a new repository on GitHub or your Git Server
https://github.com/path/name.git


2- Open Git Bash.


3- Change the current working directory to your local project.


4- run 

$ git init


5- Add the files in your new local repository. This stages them for the first commit.
$ git add .
# Adds the files in the local repository and stages them for commit. 
To unstage a file, use 'git reset HEAD YOUR-FILE'.


6- Commit the files that you've staged in your local repository.
$ git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.


before the commit above, you may set your mail and name. 
git config user.email "your-email@a.com" 
git config user.name "u-name"



7- At the top of your GitHub repository's Quick Setup page, to copy the remote repository URL


8- In the Command prompt, add the URL for the remote repository where your local repository will be pushed.
$ git remote add origin-github remote-repository-URL
# Sets the new remote
$ git remote -v
# Verifies the new remote URL


9- Push the changes in your local repository to GitHub.
$ git push origin master

# Pushes the changes in your local repository up to the remote repository you specified as the origin



PS F:\TB0723> pip install pymssql==2.2.7 Looking in indexes: https://mirrors.aliyun.com/pypi/simple Collecting pymssql==2.2.7 Using cached https://mirrors.aliyun.com/pypi/packages/64/68/c1ba0fabf98ebe9d22afc23c6b6803553b28911ed36bb53b8be93feb2446/pymssql-2.2.7.tar.gz (170 kB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: pymssql Building wheel for pymssql (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for pymssql (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [188 lines of output] <string>:32: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated. !! ******************************************************************************** Please remove any references to `setuptools.command.test` in all supported versions of the affected package. This deprecation is overdue, please update your project and remove deprecated calls to avoid build errors in the future. ******************************************************************************** !! C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\dist.py:289: UserWarning: Unknown distribution option: 'tests_require' warnings.warn(msg) C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL) See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() setup.py: platform.system() => Windows setup.py: platform.architecture() => ('64bit', 'WindowsPE') setup.py: include_dirs => [] setup.py: library_dirs => [] running bdist_wheel running build running build_py creating build\lib.win-amd64-cpython-313\pymssql copying src\pymssql\__init__.py -> build\lib.win-amd64-cpython-313\pymssql running build_ext warning: src\pymssql\_mssql.pyx:82:0: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:264:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:333:4: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:831:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:919:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:1005:12: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:1379:16: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 warning: src\pymssql\_mssql.pyx:1713:8: The 'IF' statement is deprecated and will be removed in a future Cython version. Consider using runtime conditions or C macros instead. See https://github.com/cython/cython/issues/4310 Error compiling Cython file: ------------------------------------------------------------ ... elif dbtype == SQLINT4: return int(<int>(<DBINT *>data)[0]) elif dbtype == SQLINT8: return long(<PY_LONG_LONG>(<PY_LONG_LONG *>data)[0]) ^ ------------------------------------------------------------ src\pymssql\_mssql.pyx:847:19: undeclared name not builtin: long Error compiling Cython file: ------------------------------------------------------------ ... cdef void init_mssql(): if dbinit() == FAIL: raise MSSQLDriverException("dbinit() failed") dberrhandle(err_handler) ^ ------------------------------------------------------------ src\pymssql\_mssql.pyx:2173:16: Cannot assign type 'int (DBPROCESS *, int, int, int, char *, char *) except? -1 nogil' to 'EHANDLEFUNC' (alias of 'int (*)(DBPROCESS *, int, int, int, char *, char *) noexcept'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'err_handler'. Error compiling Cython file: ------------------------------------------------------------ ... cdef void init_mssql(): if dbinit() == FAIL: raise MSSQLDriverException("dbinit() failed") dberrhandle(err_handler) dbmsghandle(msg_handler) ^ ------------------------------------------------------------ src\pymssql\_mssql.pyx:2174:16: Cannot assign type 'int (DBPROCESS *, DBINT, int, int, char *, char *, char *, LINE_T) except? -1 nogil' to 'MHANDLEFUNC' ( alias of 'int (*)(DBPROCESS *, DBINT, int, int, char *, char *, char *, int) noexcept'). Exception values are incompatible. Suggest adding 'noexcept' to the type of 'msg_handler'. Compiling src\pymssql\_mssql.pyx because it changed. [1/1] Cythonizing src\pymssql\_mssql.pyx Traceback (most recent call last): File "C:\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module> main() ~~~~^^ File "C:\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) ~~~~^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python313\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 280, in build_wheel return _build_backend().build_wheel( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ wheel_directory, config_settings, metadata_directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\build_meta.py", line 435, in build_wheel return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)]) File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\build_meta.py", line 423, in _build return self._build_with_temp_dir( ~~~~~~~~~~~~~~~~~~~~~~~~~^ cmd, ^^^^ ...<3 lines>... self._arbitrary_args(config_settings), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in _build_with_temp_dir self.run_setup() ~~~~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup super().run_setup(setup_script=setup_script) ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) ~~~~^^^^^^^^^^^^^^^^ File "<string>", line 289, in <module> File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() ~~~~~~~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) ~~~~~~~~~~~~~~~~^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\command\bdist_wheel.py", line 370, in run self.run_command("build") ~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run self.run_command(cmd_name) ~~~~~~~~~~~~~~~~^^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() ~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 368, in run self.build_extensions() ~~~~~~~~~~~~~~~~~~~~~^^ File "<string>", line 181, in build_extensions File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 484, in build_extensions self._build_extensions_serial() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 510, in _build_extensions_serial self.build_extension(ext) ~~~~~~~~~~~~~~~~~~~~^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\Cython\Distutils\build_ext.py", line 131, in build_extension new_ext = cythonize( ~~~~~~~~~^ ext,force=self.force, quiet=self.verbose == 0, **options ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ )[0] ^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize cythonize_one(*args) ~~~~~~~~~~~~~^^^^^^^ File "C:\Users\86293\AppData\Local\Temp\pip-build-env-fvhg86yf\overlay\Lib\site-packages\Cython\Build\Dependencies.py", line 1298, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: src\pymssql\_mssql.pyx [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pymssql Failed to build pymssql ERROR: Failed to build installable wheels for some pyproject.toml based projects (pymssql) 在PyCharm中安装失败
07-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值