要设置Git提交地址,需要先将远程仓库地址添加到本地仓库中。可以通过以下命令来设置Git提交地址:
cd /path/to/your/local/repository
git remote add origin https://github.com/yourusername/yourrepository.git
这里的origin
是远程仓库的别名,可以自行设置。https://github.com/yourusername/yourrepository.git
是你的远程仓库地址,根据实际情况替换成自己的地址。
git remote -v
如果成功添加远程仓库,将会显示远程仓库的地址。
现在,你可以向远程仓库提交代码了。记得在提交代码之前先将本地代码推送到远程仓库:
git push origin master
这样就可以将本地代码推送到远程仓库中了。